Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to resolve linking error. I am getting below liinking error ():

I am getting below linking error while using viOpenDefaultRM() API in my C++ code. How to resolve

 

(): Linking has failed
(): D:/Projects/OM100/07_gui/06_dev_tool/winlibs-x86_64-mcf-seh-gcc-13.2.0-mingw-w64ucrt-11.0.1-r2/mingw64/bin/../lib/gcc/x86_64-w64-
mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/Projects/OM100/07_gui/06_dev_tool/out/MyApps/FpgaVerifier/MINGWx64.De
bug.Debug_Full.Gui.Main\Test.o: in function `CONNECT_POWERSUPPLY()':
D:/Projects/OM100/07_gui/05_app_sources/MyApps/FpgaVerifier/Test.cpp (37): text+0x2ea): undefined reference to `viOpenDefaultRM'
(): collect2.exe: error: ld returned 1 exit status

0 Kudos
Message 1 of 3
(1,285 Views)

You need to add the import library for the visa32.dll to the linker options. Something like:

-lvisa32

However I see a few dragons on the path:

 

- The NI provided link library is in Microsoft COFF format. GCC had traditionally problems with that but since you use a MingW flavor of it this should be taken care of.

 

- You also need to add the search path for your NI provided compiler libraries. 

-LC:\Program Files (x86)\IVI Foundation\VISA\WinNT\lib\msc

https://stackoverflow.com/questions/12868808/how-to-tell-c-library-path-in-cygwin-and-mingw

 

But expect some difficulties. MingW always tended to be more Unix minded than Windows minded due to its underlaying GCC legacy. Not sure how that changed in recent years but it was always a hassle back in those days and as long as I had Microsoft C available it was simply not worth the extra effort to try to get things working with MingW. Nowadays even stock GCC has been getting fairly ok to deal with Windows binaries. 

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(1,247 Views)

Thank you I could resolve it. I am using U IDE which requires to add visa.lib in package manager.

 

Regards

Renun

0 Kudos
Message 3 of 3
(1,182 Views)