03-12-2024 01:06 AM
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
03-12-2024 03:35 AM - edited 03-12-2024 03:37 AM
@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:
- Install the NI-VISA software.
- Add #include <visa.h> at the top of your C++ file.
- In your project settings, add the path to the visa.h file to the include directories.
- 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.
03-12-2024 11:47 PM
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 .
03-13-2024 04:57 AM
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.