2012-02-03 223 views
1

我正在创建一个学校项目的骨干,但我遇到了“无法解析的外部符号”错误。根据此网站上提到的以前的问题,我认为必须手动将我的项目链接到.lib文件。问题是,我不知道我需要链接到哪个.lib。有人能像我十二岁那样解释吗?另一个LNK2019:无法解析的外部符号

1>------ Build started: Project: Birthday311, Configuration: Debug Win32 ------ 
1>Build started 2/2/2012 07:55:30 PM. 
1>InitializeBuildStatus: 
1> Touching "Debug\Birthday311.unsuccessfulbuild". 
1>ClCompile: 
1> All outputs are up-to-date. 
1>ManifestResourceCompile: 
1> All outputs are up-to-date. 
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Birthday::getDay(void)const " ([email protected]@@QBEHXZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" ([email protected]@[email protected]@@Z) 
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Birthday::getMonth(void)const " ([email protected]@@QBEHXZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" ([email protected]@[email protected]@@Z) 
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Birthday::getName(void)const " ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@XZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" ([email protected]@[email protected]@@Z) 
1>C:\Users\Ender\Documents\Visual Studio 2010\Projects\Birthday311\Debug\Birthday311.exe : fatal error LNK1120: 3 unresolved externals 
+0

我们应该怎样知道哪个'.lib'文件?哪一个包含'Birthday :: getDay'和'Birthday :: getMonth'函数的定义?那些不是我知道的任何标准库的一部分,所以你必须自己写下它们。 – 2012-02-03 05:05:12

+0

哦,你帮我找出正确的答案。看看我的.cpp文件,我意识到我简单地将getDay和getMonth函数称为“int getDay()',而不是'int Birthday :: getDay()const'。 谢谢! – derp 2012-02-03 05:21:53

回答

0

看起来像你没有实际实现函数getDay,getMonth和getName。

+0

哦,你帮我找出正确的答案。看看我的.cpp文件,我意识到我简单地将getDay和getMonth函数称为“int getDay()”,而不是'int Birthday :: getDay()const'。基本上,我没有正确实现getDay和getMonth函数。谢谢! – derp 2012-02-03 05:22:44

相关问题