LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use LabWindows/cvi function under MS Visual C++

I am programming in C++ for a DAQ system, but need to use some function such as User Interface Resource (.uir) developed under LabWindows/cvi. When compiling, it works, but when liking it has errors. I also tried to compile a sample code under C++ (Sample5 in the tutorial of LabWindows/CVI, it work under LabWindows/CVI), the same thing happened. Could you let me know why or how I can use LabWindows functions under C++. Thanks!
0 Kudos
Message 1 of 2
(3,009 Views)
I’m not sure exactly what was causing the linking errors that you received, but you can successfully use most of the CVI libraries as well as source and object modules you create yourself in external compilers like Visual C++.

I noticed that you said you had just tried to compile and link the source of one of the tutorial examples, but am not quite sure if you meant that literally. When you try to build an .exe in any compiler you must make sure that all source files are compilable (no syntax errors and all typedefs are available) and that all definitions are available for symbols you have used in your source for proper linking. This means that you need to include the proper header files or paths to the project as well as all .c, .obj, or .lib files that contain the definitions of functions you use in your program’s source (Look at Chapter 3 of the CVI Programmer’s Reference Manual for information on using CVI libraries in external compilers).

Programmer’s Reference Manual -> http://digital.ni.com/manuals.nsf/web_productcurrent/DF4E98480EEBF971862568160075AB6F?OpenDocument

In short you should look through the source of the example you are trying to build and just make sure the project knows where the header files and .libs are located.

On top of that though, when you are trying to use a .uir file in an external compiler you need to build a source file with a UIR object callback table so that the User Interface library functions know where the callback functions for UI objects are located in your app’s source. The instructions for making this file are detailed in Chapter 3 of the Programmer’s Reference Manual as well.

A nice thing about the new Measurement Studio package that not only has LabWindows/CVI 5.5 or higher but also Tools for Visual C++ (a.k.a Measurement Studio for Visual C++), is that Tools for VC++ contains a Visual C++ add-in called the Measurement Studio AppWizard project creator which has the ability to convert a CVI project into a Visual C++ project, so you might look into this as well if you have Measurement Studio.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
0 Kudos
Message 2 of 2
(3,009 Views)