LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to find visa.h library for my cpp program

I am trying to create a cpp function which will control my harware instruments but i dont know how to start and where to include the ni-visa library ,please help

0 Kudos
Message 1 of 4
(1,184 Views)

@JamieC012 wrote:

@sanjeev553 wrote: 

I am trying to create a CPP function which will control my hardware instruments but I do not know how to start and where to include the ni-visa library, please help


Hello,

 

There are some possible ways to fix this issue. You can use the visa.h library in your C++ project, follow these steps: 

  1. Install the NI-VISA software.
  2. Add #include <visa.h> at the top of your C++ file.
  3. In your project settings, add the path to the visa.h file to the include directories.
  4. Link your project with the VISA library (like visa32.lib).

And the location where VISA installs these files is:

 

Include files: <Program Files x86>\IVI Foundation\VISA\WinNT\Include

Libraries 32-bit: <Program Files x86>\IVI Foundation\VISA\WinNT\lib\msc\visa32.lib

Libraries 64-bit: <Program Files x86>\IVI Foundation\VISA\WinNT\Lib_x64\msc\visa64.lib

 

There is likely also similar or the same files in <Program Files> but with a slightly different directory hierarchy. Either should work if you use Visual Studio.

 

Other compilers are not supported if they can't use the Microsoft COFF object library format.

 

And step 3 should add both the include path as well as the library path to either the compiler settings or the project settings. Watch out that you need to have different directories for the 32-bit and 64-bit compilation and also use different library names in the linker settings of your project.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 4
(1,145 Views)

Thanks for your help buddy .

But the the thing is i am using UBUNTU  OS and i have installed the ni-visa driver from the ni-visa website.

From there i got some .rpm and some .deb file , i have installed them ,(all rpm files using alien command and  all deb files using dpkg) 

Now i am creating a cpp program(sample code i got from ni-visa website Example of Message-Based Communication - NI)  but my code is not able to find the visa.h library could you please help or illustrate me the steps where i am missing .

0 Kudos
Message 3 of 4
(1,090 Views)

Seems you did the proper installations. On my Fedora system with NI Drivers 2020 installed the header files are located at /usr/include/ni-visa.

 

So you probably either should do:

#include "ni-visa/visa.h"

 

or you could add an -Ini-visa parameter to your gcc build command.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(1,070 Views)