问题描述
在构建我的项目时,我收到以下错误:
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
这篇关于错误LNK2001:与VS C ++ 6.0链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!