0

I tried to port a LabCVI Project to MSVS 2010 C++ Express. There is a line of code which reads like this:

if (InitCVIRTE == 0) return 0;

A Linker Error occurs: LNK2019 "_InitCVIRTEEx@12" - all relevant header already feature the cpp statements:

#ifdef __cplusplus 
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif

I traced the error back to these snippets, that I combined for you:

#define CVIFUNC __stdcall
int CVIFUNC InitCVIRTEEx (void *hInstance, char *argv[], void *reserved);
#define InitCVIRTE InitCVIRTEEx

To sum this up:

int __stdcall InitCVIRTEEx (void *hInstance, char *argv[], void *reserved);

This Call should be defined in the cvirt.lib - which is added to the Librarypaths (CVI2009\extlib\msvc) The Linker Error still occurs and I just don't get why.

Should the lib be added in a different way? How can I verify that this really is the right lib? Does the Error mean something completely different?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Johannes
  • 6,490
  • 10
  • 59
  • 108

2 Answers2

2

You need to tell the linker what libraries to link in. The search path will only tell the linker where to find those libraries.

i.e:

Linker Libraries:
 - a.lib
 - b.lib

Linker Search Dirs:
 C:\project_a\lib
 C:\project_b\lib

the linker will search both folders for a.lib and b.lib but will not link any libraries it hasnt been told about.

Lodle
  • 31,277
  • 19
  • 64
  • 91
0

I somehow just resolved it - i added cvirt.lib and cvisupp.lib direktly to the project. The error is gone now...

however i am still not satisfied because i already gave the project the path where it should look for libraries. I will add another question to stackoverflow asking what the difference is.

Johannes
  • 6,490
  • 10
  • 59
  • 108