Jump to content

Visual Studio 2008 with Labview command


Recommended Posts

Hi

I want to use the following Labview/CVI commando: PlotWaveform in Visual Studio 2008.

I have included the following files:

#include "stdafx.h"

#include <stdio.h>

#include <winsock2.h>

#include <stdlib.h>

#include <utility.h>

#include <ansi_c.h>

#include <cvirte.h>

#include <userint.h>

I have linked to the following Labview DLL files: WS2_32.lib labview.lib lvsb.lib

I have the following relevant commands in my project:

//Setup CVI

if (InitCVIRTE (0, 0,0)==0)

return -1; //Out of memory

// Plot waveform

PlotWaveform (panelHandle, PANEL_GRAPH, waveformPtr,

numberofpoints, VAL_DOUBLE, 1.0,0.0,InitialX,

XInitial,VAL_THIN_LINE,VAL_NO_POINT, VAL_SOLID, 1, VAL_BLUE);

// Refresh graph now

RefreshGraph (panelHandle, PANEL_GRAPH);

But I get the follownig error:

Error 1 error LNK2001: unresolved external symbol _InitCVIRTEEx@12

Error 2 error LNK2001: unresolved external symbol _PlotWaveform@72

Error 3 error LNK2001: unresolved external symbol _RefreshGraph@8

I donĀ“t understand the error, could it bee a linker problem?

Does anyone understand the errors? Or do you have a guide for how you use Labview commands in Visual Studio?

I have used the following guide:

http://www.ni.com/pdf/manuals/370109b.pdf

But I ended up with the errors I explained.

BR

Benjamin

Link to comment

QUOTE (bandersen @ Oct 28 2008, 08:52 AM)

I want to use the following Labview/CVI commando: PlotWaveform in Visual Studio 2008.

I'm confused - are you trying to call LabVIEW from Visual Studio, or are you trying to call LabWindows/CVI? LabVIEW and Labwindows/CVI are two very different things.

Link to comment

QUOTE (crelf @ Oct 28 2008, 11:03 PM)

I'm confused - are you trying to call LabVIEW from Visual Studio, or are you trying to call LabWindows/CVI? LabVIEW and Labwindows/CVI are two very different things.

Hi

I am trying to call LabWindows/CVI from Visual Studio, I want to use the function PlotWaveform.

BR

Benjamin

Link to comment

QUOTE (bandersen @ Oct 31 2008, 03:21 AM)

Use NI's Measurement Studio if you want to use the plotting features like the ones available in LabWindows or LabVIEW in Visual Studio. These toolkits are designed for Visual Studio and the .NET environment and there's lots of information, help files, etc. to do just what it appears you want to do. See this link for a quick description.

http://cnx.org/content/m14741/latest/

I don't have any experience trying to call LabWindows libraries from Visual Studio, but the error you show in your original post is definitely a linker issue - your code is not linking properly to the libraries. I don't have any ideas about how to fix it.

Lastly, if you have LabWindows/CVI, it includes an integrated development environment (IDE) and that's the best way to program in C and use the LabWindows libraries.

Mark

Link to comment

QUOTE (crelf @ Oct 28 2008, 04:03 PM)

I'm confused - are you trying to call LabVIEW from Visual Studio, or are you trying to call LabWindows/CVI? LabVIEW and Labwindows/CVI are two very different things.

Hello banderson,

LabWindows/CVI does install two Visual Studio project wizards:

LabWindows/CVI Project - A project for creating an application that incorporates the LabWindows/CVI run-time libraries

LabWindows/CVI Conversion - Converts an existing LabWindows/CVI project into a Visual C++ project

These appear in the Visual C++>>LabWindows/CVI section of the New project dialog in Visual Studio (once you install LabWindows/CVI).

These wizards do not support Visual Studio 2008.

We are actively working on a new version of LabWindows/CVI that will support the latest version of Visual Studio (i.e using CVI libraries in VS08, and using the VS08/MFC 9.0 compiler within CVI). This version should release by the end of the year.

Also, since it seems that you are a C/C++ Visual Studio developer, something to note is that we are also actively working on releasing a version of Measurement Studio that supports C++/MFC 9.0 in Visual Studio 2008 (class libraries, Data acquisition and instrument control APIs, integration etc). This release will come out the same time as the new version of CVI referenced above. If you have SSP, you'll get the new version automatically. If you need beta versions of CVI or Measurement Studio, feel free to contact me at wendy(dot)logan(at)ni(dot)com.

Note: .NET in VS 2008 is already supported by Measurement Studio, NI-DAQmx, VISA, GPIB, and the modular instruments drivers such as NI-Scope.

Thanks

Wendy L

Product Manager - LabWindows/CVI and Measurement Studio

Link to comment

QUOTE (Wendy L @ Nov 1 2008, 03:56 AM)

Hello banderson,

LabWindows/CVI does install two Visual Studio project wizards:

LabWindows/CVI Project - A project for creating an application that incorporates the LabWindows/CVI run-time libraries

LabWindows/CVI Conversion - Converts an existing LabWindows/CVI project into a Visual C++ project

These appear in the Visual C++>>LabWindows/CVI section of the New project dialog in Visual Studio (once you install LabWindows/CVI).

These wizards do not support Visual Studio 2008.

We are actively working on a new version of LabWindows/CVI that will support the latest version of Visual Studio (i.e using CVI libraries in VS08, and using the VS08/MFC 9.0 compiler within CVI). This version should release by the end of the year.

Also, since it seems that you are a C/C++ Visual Studio developer, something to note is that we are also actively working on releasing a version of Measurement Studio that supports C++/MFC 9.0 in Visual Studio 2008 (class libraries, Data acquisition and instrument control APIs, integration etc). This release will come out the same time as the new version of CVI referenced above. If you have SSP, you'll get the new version automatically. If you need beta versions of CVI or Measurement Studio, feel free to contact me at wendy(dot)logan(at)ni(dot)com.

Note: .NET in VS 2008 is already supported by Measurement Studio, NI-DAQmx, VISA, GPIB, and the modular instruments drivers such as NI-Scope.

Thanks

Wendy L

Product Manager - LabWindows/CVI and Measurement Studio

Hi

And thanks for the answers. I have been told that it is possible to include the .h files from Labview and then use these files to do the drawing of the graph. I have also solved the linker problem. But now I get a -10 error when I try to use PlotWaveform. Could you please have a look at my code:

#include "stdafx.h"

#include <stdio.h>

#include <winsock2.h>

#include <stdlib.h>

#include <utility.h>

#include <ansi_c.h>

#include <cvirte.h>

#include <userint.h>

if (InitCVIRTE (0, 0,0)==0)

return -1; //Out of memory

int panelHandle = NewPanel(parentPanel,"Graph",top,left,height,with);

printf("panelHandle: %d\n",panelHandle);

int nNewCtrl = NewCtrl(panelHandle,CTRL_NUMERIC,0,10,10);

printf("nNewCtrl: %d\n",nNewCtrl);

DisplayPanel (panelHandle);

int PlotWaveform_RETURN_VALUE = PlotWaveform (panelHandle, nNewCtrl, myArray,4,VAL_DOUBLE,1.0,0.0,0.0,1.0,VAL_FAT_LINE,VAL_DOTTED_SOLID_SQUARE,VAL_SOLID,1,VAL_RED);

printf("PlotWaveform_RETURN_VALUE: %d\n",PlotWaveform_RETURN_VALUE);

RefreshGraph (panelHandle, nNewCtrl);

The result when I run the program is the following:

panelHandle: 1

nNewCtrl: 2

PlotWaveform_RETURN_VALUE: -10

What is the problem with the PlotWaveform function, what does the -10 error indicate?

BR

Benjamin

Link to comment

QUOTE (bandersen @ Nov 2 2008, 07:48 AM)

Hi

And thanks for the answers. I have been told that it is possible to include the .h files from Labview and then use these files to do the drawing of the graph. I have also solved the linker problem. But now I get a -10 error when I try to use PlotWaveform. Could you please have a look at my code:

#include "stdafx.h"

#include <stdio.h>

#include <winsock2.h>

#include <stdlib.h>

#include <utility.h>

#include <ansi_c.h>

#include <cvirte.h>

#include <userint.h>

if (InitCVIRTE (0, 0,0)==0)

return -1; //Out of memory

int panelHandle = NewPanel(parentPanel,"Graph",top,left,height,with);

printf("panelHandle: %d\n",panelHandle);

int nNewCtrl = NewCtrl(panelHandle,CTRL_NUMERIC,0,10,10);

printf("nNewCtrl: %d\n",nNewCtrl);

DisplayPanel (panelHandle);

int PlotWaveform_RETURN_VALUE = PlotWaveform (panelHandle, nNewCtrl, myArray,4,VAL_DOUBLE,1.0,0.0,0.0,1.0,VAL_FAT_LINE,VAL_DOTTED_SOLID_SQUARE,VAL_SOLID,1,VAL_RED);

printf("PlotWaveform_RETURN_VALUE: %d\n",PlotWaveform_RETURN_VALUE);

RefreshGraph (panelHandle, nNewCtrl);

The result when I run the program is the following:

panelHandle: 1

nNewCtrl: 2

PlotWaveform_RETURN_VALUE: -10

What is the problem with the PlotWaveform function, what does the -10 error indicate?

BR

Benjamin

Hello,

Just to clarify, the .h files should be from LabWindows/CVI not from LabVIEW. These are two separate National Instruments products.

But the reason you are still receiving the error is because you are trying to plot a waveform to a numeric control.

int nNewCtrl = NewCtrl(panelHandle,CTRL_NUMERIC,0,10,10);

int PlotWaveform_RETURN_VALUE = PlotWaveform (panelHandle, nNewCtrl, myArray,4,VAL_DOUBLE,1.0,0.0,0.0,1.0,VAL_FAT_LINE,VAL_DOTTED_SOLID_SQUARE,VAL_SOLID,1,VAL_RED);

PlotWaveform is meant to be used to plot an array of data to a LabWindows/CVI graph.

For further reference, the "Using LabWindows/CVI Libraries in External Compilers" topic of the CVI help mentions that the -10 error means that you are passing the wrong control type to the function.

Thanks

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.