开发者

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

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜