错误LNK2001:与VS C ++ 6.0链接错误 [英] error LNK2001: Linking error with VS C++ 6.0

查看:109
本文介绍了错误LNK2001:与VS C ++ 6.0链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建我的项目时,我收到以下错误:


Test1Dlg.obj:错误LNK2001:未解析的外部符号" int __cdecl get_contact_state(enum CONTACT)" (?get_contact_state @@ YAHW4CONTACT @@@ Z)

Debug / Test1.exe:致命错误LNK1120:1个未解析的外部


我已将函数包括在内它是Test1Dlg.cpp中的标题所以它应该可以工作。如果我不调用该函数,则没有错误。

项目已知头文件的目录,其他文件链接没有任何问题。


任何想法可能有什么问题都会有所帮助!

When building my project, I''m getting following error:

Test1Dlg.obj : error LNK2001: unresolved external symbol "int __cdecl get_contact_state(enum CONTACT)" (?get_contact_state@@YAHW4CONTACT@@@Z)
Debug/Test1.exe : fatal error LNK1120: 1 unresolved externals

I have included the function by it''s header in Test1Dlg.cpp so it should work. There is no error if I dont call the function.
The directory of the header file is known to the project, the other files would link without any problem.

Any idea what could be the problem would be helpful!

推荐答案


在构建我的项目时,我'' m得到以下错误:


Test1Dlg.obj:错误LNK2001:未解析的外部符号" int __cdecl get_contact_state(enum CONTACT)" (?get_contact_state @@ YAHW4CONTACT @@@ Z)

Debug / Test1.exe:致命错误LNK1120:1个未解析的外部


我已将函数包括在内它是Test1Dlg.cpp中的标题所以它应该可以工作。如果我不调用该函数,则没有错误。

项目已知头文件的目录,其他文件链接没有任何问题。


任何想法可能会有什么问题都会有所帮助!
When building my project, I''m getting following error:

Test1Dlg.obj : error LNK2001: unresolved external symbol "int __cdecl get_contact_state(enum CONTACT)" (?get_contact_state@@YAHW4CONTACT@@@Z)
Debug/Test1.exe : fatal error LNK1120: 1 unresolved externals

I have included the function by it''s header in Test1Dlg.cpp so it should work. There is no error if I dont call the function.
The directory of the header file is known to the project, the other files would link without any problem.

Any idea what could be the problem would be helpful!



提到该函数的原型只是让编译器闭嘴。

尽管仍然没有保证是否存在该函数的编译版本

,并且您必须将该编译版本提供给链接器。


你没有这样做所以连接器张开嘴。如果该函数存储在

库中,则必须将该库提供给链接器,否则如果已编译的函数

仅在其自己的.o或.obj中可用文件你应该把它提供给链接器。


亲切的问候,


Jos

Mentioning that function''s prototype available just keeps the compiler''s mouth shut.
There''s still no guarantee though whether or not a compiled version of that function
exists and you have to make that compiled version available to the linker.

You didn''t do that so the linker opened its mouth. If that function is stored in a
library you have to feed that library to the linker, otherwise if the compiled function
is just available in its own .o or .obj file you should feed that to the linker.

kind regards,

Jos


标题允许程序编译。您收到链接器错误,这意味着您忘记链接库。您需要指定库目录和链接的实际库。
The header allows the program to compile. You are getting a linker error, which means you forgot to link the library in. You need to specify the library directory and the actual library that gets linked in.


Thx为您提供帮助!

该函数不是通过库提供的,而是作为obj-File,位于与其标题相同的目录中。这就是为什么我期待链接器找到它。实际上,所有obj-Files都在Debug-Folder中,编译器将它们放在那里。
Thx for your help so far!
The function is NOT available via a library but as a obj-File located in the same dir than its header. Thats why Im expecting the linker to find it. Actually, all obj-Files are in the Debug-Folder where the compiler put them.


这篇关于错误LNK2001:与VS C ++ 6.0链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆