我在Visual C++ 2010環境中有一個未來的命令行程序。我使用MySQL ++庫,它是正確構建和安裝的。Visual C++鏈接器錯誤「已在OBJ中定義」和「未解析的外部符號」(Mysql ++)
首先,我在stdafx.h中定義了一些全局變量(程序非常簡單,所以我基本上使用該文件來滿足我所有的頭文件需求,並且不使用任何其他頭文件。定義」 ... 「#ENDIF」。包裝鏈接抱怨:
Error 2 error LNK2005: "__int64 last_local_time" ([email protected]@3_JA) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
Error 3 error LNK2005: "bool debug" ([email protected]@3_NA) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
Error 4 error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > user" ([email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@A) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
Error 5 error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > server" ([email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@A) already defined in coreprocessing.obj C:\Tsukasa\ilya\DataImporter\DataImporter\stdafx.obj
其他鏈接錯誤都與MySQL有關的++庫
Error 9 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall mysqlpp::Query::`vbase destructor'(void)" ([email protected]@@QAEXXZ) referenced in function "class mysqlpp::Query * __cdecl connectToDb(void)" ([email protected]@[email protected]@@XZ) C:\Tsukasa\ilya\DataImporter\DataImporter\coreprocessing.obj
Error 10 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall mysqlpp::DateTime::operator __int64(void)const " ([email protected]@@QBE_JXZ) referenced in function "class mysqlpp::Query * __cdecl connectToDb(void)" ([email protected]@[email protected]@@XZ) C:\Tsukasa\ilya\DataImporter\DataImporter\coreprocessing.obj
而在屬性。 「庫目錄」 包括LIB文件夾的路徑對於MySQL ++,配置是Debug,並且在我有以下文件LIB文件夾:** mysqlpp_d.dll mysqlpp_d.lib **。
我很感謝能否幫助我做出錯誤的見解。
可能的重複[LNK2005:「已定義錯誤](http://stackoverflow.com/questions/10140973/lnk2005-already-defined-error) – 2012-08-12 16:14:52
謝謝。的確,看起來非常像。 – 2012-08-12 16:29:26