Im有錯誤LNK2019:無法解析的外部符號問題。錯誤LNK2019:無法解析的外部符號 - 未見問題的實例
我有2個文件,並將它們移動到共享位置,因此2個不同的項目可以使用類。 這裏還有其他類。
的問題是,當我從項目之一的主調用類的即時得到
error LNK2019: unresolved external symbol "public: __thiscall CProcessCommandLine::~CProcessCommandLine(void)" ([email protected]@[email protected]) referenced in function _main
error LNK2019: unresolved external symbol "public: bool __thiscall CProcessCommandLine::Wait(void)const " ([email protected]@@QBE_NXZ) referenced in function _main
error LNK2019: unresolved external symbol "public: class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const & __thiscall CProcessCommandLine::getTargetNamesVect(void)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@XZ) referenced in function _main
error LNK2019: unresolved external symbol "public: __thiscall CProcessCommandLine::CProcessCommandLine(void)" ([email protected]@[email protected]) referenced in function _main
當我打開的功能之一的頭文件,右鍵點擊並進入去定義它不會轉到.cpp中的定義。當我右鍵點擊.cpp中的一個函數,並說定義它說「符號沒有定義」。
任何人都知道爲什麼會發生這種情況?無論是.H和.cpp是在相同的位置和該位置是在附加包含該項目的目錄
編輯:
在其他文件中存在此文件夾中的以下代碼:
#ifdef PROJ1
#include "class1.h"
#elif PROJ2
#include "class2.h"
#endif
我以前從未見過這些東西。它們用於代碼中,但僅用於包含正確的頭文件,具體取決於使用哪個項目。以上內容位於此文件夾中其他類的.cpp文件中。所以我把它放在這裏。但是在其他類中,它不屬於的項目是灰色的。當我將它放入.h時,它將正確的標題灰色化。但由於某些原因,這個.cpp並未被視爲該項目的一部分。
我不認爲你是鏈接對象/庫是你嗎? – trojanfoe 2012-04-17 12:29:50
也許不是。在編譯/鏈接過程中一起完成了所有其他任務,但顯然不是。對象/庫在哪裏? – discodowney 2012-04-17 12:56:13