[英]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.我尝试将 LabCVI 项目移植到 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:发生链接器错误:LNK2019 "_InitCVIRTEEx@12" - 所有相关标头都已包含 cpp 语句:
#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.这个调用应该在 cvirt.lib 中定义——它被添加到 Librarypaths (CVI2009\\extlib\\msvc) 链接器错误仍然发生,我只是不明白为什么。
Should the lib be added in a different way?应该以不同的方式添加 lib 吗? 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.您需要告诉链接器要链接哪些库。搜索路径只会告诉链接器在哪里可以找到这些库。
ie:即:
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.链接器将在两个文件夹中搜索 a.lib 和 b.lib,但不会链接任何它没有被告知的库。
I somehow just resolved it - i added cvirt.lib and cvisupp.lib direktly to the project.我以某种方式解决了它 - 我直接将 cvirt.lib 和 cvisupp.lib 添加到项目中。 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.
我将向 stackoverflow 添加另一个问题,询问有什么区别。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.