链接器错误 LNK2019 追溯到 __stdcall 我认为我得到了正确的库 - 我该怎么做才能解决这个问题?
我尝试将 LabCVI 项目移植到 MSVS 2010 C++ Express。有一行代码如下所示:
if (InitCVIRTE == 0) return 0;
发生链接器错误:LNK2019“_InitCVIRTEEx@12”-所有相关标头都已包含 cpp 语句:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
我将错误追溯到这些片段,我为您组合了:
#define CVIFUNC __stdcall
int CVIFUNC InitCVIRTEEx (void *hInstance, char *argv[], void *reserved);
#define InitCVIRTE InitCVIRTEEx
总结一下up:
int __stdcall InitCVIRTEEx (void *hInstance, char *argv[], void *reserved);
此调用应该在 cvirt.lib 中定义 - 它被添加到库路径 (CVI2009\extlib\msvc) 链接器错误仍然发生,我只是不明白为什么。
应该以不同的方式添加库吗? 我如何验证这确实是正确的库? 该错误是否意味着完全不同的东西?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要告诉链接器要链接哪些库。搜索路径只会告诉链接器在哪里可以找到这些库。
即:
链接器将在两个文件夹中搜索 a.lib 和 b.lib,但不会链接任何未告知的库。
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:
the linker will search both folders for a.lib and b.lib but will not link any libraries it hasnt been told about.
我以某种方式解决了它 - 我将 cvirt.lib 和 cvisupp.lib 直接添加到项目中。错误现在消失了......
但是我仍然不满意,因为我已经为项目提供了它应该查找库的路径。我将在 stackoverflow 上添加另一个问题,询问有什么区别。
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.