简体   繁体   English

链接器错误 LNK2019 追溯到 __stdcall 我想我得到了正确的库 - 我该怎么做才能解决这个问题?

[英]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.

相关问题 在Visual Studio 2013中包含“ zlib”时,如何解决链接器错误LNK2019? - How do I resolve linker error LNK2019 while including “zlib” in my Visual Studio 2013? 错误LNK2019,我该如何解决? *更新* - Error LNK2019, how do I solve this? *update* 我有第三方lib,我有错误LNK2019:外部未解决…如何进行调查以解决问题 - I have a third party lib, I have error LNK2019: unresolved external … How to investigate to fix it 我在 UE_4.26 中的一个模块中收到 Linker 错误 LNK2019 - I am getting Linker error LNK2019 in one of my modules in UE_4.26 链接器错误LNK2019 - Linker Error LNK2019 链接器错误LNK2019? - Linker error LNK2019? 收到错误LNK2019和LNK1120,无法弄清楚我在做什么 - Getting error LNK2019 and LNK1120, can't figure out what I'm doing wrong 我收到“未解析的外部符号”错误,但它可以在 Visual Studio LNK2019/LNK 1120 中访问它们 - I get an “unresolved external symbol” error, but it can access them in visual studio LNK2019/LNK 1120 C ++错误LNK2028,LNK2019和LNK1120。 它们是什么意思,我该如何解决? - C++ errors LNK2028, LNK2019 and LNK1120. What do they mean and how do I solve them? 是什么导致我收到链接器错误LNK2019? - What is causing me to get the linker error LNK2019?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM