Linker Error LNK2019 traced back to an __stdcall i think i got the right lib - what can i do to resolve this?

StackOverflow https://stackoverflow.com/questions/4459369

Question

I try to port a LabCVI Projekt to MSVS 2010 C++ Express. There is a line of code wich 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 - wich is added to the Librarypaths (CVI2009\extlib\msvc) The Linker Error still occurs and i just dont 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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top