我在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