2012-02-03 215 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

相關問題