erreur : undefined reference to `viOpenDefaultRM@4'
-
Hello,
I'm looking to use the right DLL package in order to define viOpenDefaultRM@4
However, after including the path to the DLL folder in WD_V5-masterv2.pro as you can see the lines below, I get viOpenDefaultRM not defined.INCLUDEPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL' DEPENDPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL'
Right below, the code that I'm trying to run in a .cpp file in order to detect a PXI address
// Connect to PXI test #include "stdio.h" #include "IviVisaType.h" #include "visa.h" #include "visatype.h" #include "vpptype.h" //#include "stdafx.h" void discoverPXI() { ViSession rm = VI_NULL; viOpenDefaultRM( &rm ); ViChar search[] = "PXI?*::INSTR"; ViFindList find = VI_NULL; ViUInt32 count = 0; ViChar rsrc[256]; ViStatus status = viFindRsrc( rm, search, &find, &count, rsrc ); if( status==VI_SUCCESS && count>0 ) { do { printf( "Found: \"%s\"\n", rsrc ); status = viFindNext( find, rsrc ); } while( status==VI_SUCCESS ); viClose( find ); } else if( count==0 ) { printf( "No PXI instrument found\n" ); } viClose( rm ); //return 0; }
Any suggestion will be appreciated.
Thank you in advance -
@Chaymoss said in erreur : undefined reference to `viOpenDefaultRM@4':
INCLUDEPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL'
DEPENDPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL'
These lines do not look syntactically correct.
I don't know if you need to add something toLIBS
? -
Thank you JonB for your reply.
I did use the following lines of code :
LIBS = +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\NationalInstruments.Common.dll" LIBS = +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\niVISAsys.dll"
However, I get this error :
:-1: erreur : error: +=C:\Users\operateur\Documents\CB\WD_V5-masterv2\niVISAsys.dll: Invalid argument
When I comment out the second line I get this :
:-1: erreur : error: +=C:\Users\operateur\Documents\CB\WD_V5-masterv2\NationalInstruments.Common.dll: Invalid argument
Can you tell me what's wrong with using the whole folder that contains all the DLLs?
Thank you in advance. -
Thank you, it's my first time coding with C/C++ in Qt Creator.
After correcting the syntax:LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.Common.dll" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\niVISAsys.dll"
I get the following error :
C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\niVISAsys.dll:-1: erreur : file not recognized: File format not recognized
Does that mean that the file has been corrupted?
Thank you in advance -
@Chaymoss
You do not linkDLL
files, rather the.LIB
or.a
file supplied with the DLL for those who want to link against it.BTW this is not a C/C++ or Creator issue.
You need to be following some instructions from the package you are trying to use.
-
Thank you JonB for your answer.
Above, you can see the instructions that I should follow in order to use the driver.
In WD_V5-masterv2.pro, I added these paths :INCLUDEPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Lib/msc' DEPENDPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Lib/msc' INCLUDEPATH += $$PWD/'fftw' DEPENDPATH += $$PWD/'fftw' INCLUDEPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Include' DEPENDPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Include' INCLUDEPATH += 'C:\Program Files (x86)\IVI Foundation\IVI\Lib_x64\msc' DEPENDPATH += 'C:\Program Files (x86)\IVI Foundation\IVI\Lib_x64\msc'
And I added this .LIB file :
LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqMD3.lib"
However, I'm getting the same error :
C:\Users\operateur\Documents\CB\WD_V5-masterv2\mainwindow.cpp:1034: erreur : undefined reference to `viOpenDefaultRM@4' debug/mainwindow.o: In function `Z11discoverPXIv': C:\Users\operateur\Documents\CB\WD_V5-masterv2/mainwindow.cpp:1034: undefined reference to `viOpenDefaultRM@4'
Is there another step that I'm missing?
Help please.
Thank you -
I tried to add all the needed (I think?) .DLL files :
LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.Common.dll" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.VisaNS.dll" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NIDCPower.Fx45.dll" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.DAQmx.dll" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NISwitch.Fx45.dll" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NIScope.Fx45.dll" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqMD3.lib"
And now, I'm getting this error :
11:29:47: Starting C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe... 11:29:47: Failed to run program. Wrong path or permissions? 11:29:47: C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe exited with code -1
Is there a specific permession or a configuration that I should do for Qt Creator?
Thank you in advance. -
@Chaymoss
I really don't know. I still don't think any.DLL
files should be in yourLIBS
. I don't know if you aren't supposed to act on the "Prefix function calls with AqMD3_".The library looks like it is an MSVC one, like it tells you. But the error message looks like you are using MinGW compiler/linker for your Qt? You have not mentioned this? Do you not think that is relevant? You cannot mix MinGW and MSVC code/modules/libraries....
-
Thank you JonB for your reply.
Yes, now I'm noticing the added compiler MSVC, which is automatically added by Qt, as you can see in the image down below :
Should I delete MinGW or convert MSVC libraries to MinGW?
I can't see how to do that, should I remove all the traces of code that use MinGW in the project?
Thank you in advance. -
@Chaymoss said in erreur : undefined reference to `viOpenDefaultRM@4':
Should I delete MinGW or convert MSVC libraries to MinGW?
You should not "delete" anything, and you cannot "convert" libraries between MSVC & MinGW.
I am assuming you have some
.lib
file(s) given to you with this package? They are already compiled with MSVC for you to use, you are not compiling their source code to produce a library yourself, right?Then you need to pick the kit you want Qt Creator to use. One of the MSVC and not MinGW ones. One "wrinkle" is I don't know whether the library you have requires MSVC 2015 or 2019. Obviously you must also match the correct 32- or 64-bitness.
-
Thank you for your response.
I'm not looking to produce a library, I'm just trying to communicate with a PCIe, to use a PXI module for signal acquisition.
In order to achieve that, I think I should use a Driver provided by the manufacturer of the PCIe.
In this case the driver is AqMD3 IVI-C as you can see in the documentation
I added the .lib files in the project folder as you can see here :
Adding them means that they will be compiled? The problem is I'm getting viOpenDefaultRM undefined beside other functions.
I'm adding all the libraries that I can find hoping to get one that works and define all the undefined functions (I'm not sure if this is the best strategy) that they are using in their provided code to detect the PXI module (I shared the code in my first post).
I chose MSVC 2015 64bit as a kit, because I don't have VS2015 so I guess it's there because their libraries are compiled with 2015 version. However, I recently installed the 2019 so maybe Qt detected that automatically and presented it in the Kits. Down below you can see the chosen kit:
I also chose 64bit because I have 64 bit processor and I added their 64 bit libraries as follow :
LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqMD3.lib" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqLio.lib" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\IviConfigServer.lib" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\IviCShared.lib" LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\IviFloat.lib"
You can also see what I have as compilers :
Not sure what I should use other than C/C++, I'm not finding MSVC 2015.
Now I'm just getting the error :15:08:02: Starting C:\Users\operateur\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe... 15:08:02: Failed to run program. Wrong path or permissions? 15:08:02: C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe exited with code -1
Any suggestion please?
Thank you in advance -
In the compilation output the error is displayed as follow :
16:01:10: Start: "C:\Qt\Tools\mingw810_32\bin\mingw32-make.exe" -j8 C:/Qt/Tools/mingw810_32/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Directory Entry 'C:/Users/operateur/Documents/CB/WD_V5-masterv2' mingw32-make[1]: Nothing to do for 'first'. mingw32-make[1]: Leaving the directory 'C:/Users/operateur/Documents/CB/WD_V5-masterv2'