今天我添加了一个管理MySQL服务器连接的类。它将是多线程的,所以我想使用mysql ++。我下载了最新版本并在调试模式下编译,没有任何错误。一旦我将已编译的mysqlpp_d.lib
添加到我的解决方案中,当然还有其他要求(mysql 5.0 include和lib),我得到了一些链接器错误。
Error 17 error LNK1169: one or more multiply defined symbols found C:\Users\root\Documents\Visual Studio 2010\Projects\C++\xxxx\binaries\xxxx.exe 1 1 xxxxx
Error 16 error LNK2005: "public: __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >(int)" (??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z) already defined in xxxxxx.obj C:\Users\root\Documents\Visual Studio 2010\Projects\C++\xxxx\trunk\vc10\xxxxx\mysqlpp_d.lib(mysqlpp_d.dll) xxxxxxx
Error 15 error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const " (?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ) already defined in client_context.obj C:\Users\root\Documents\Visual Studio 2010\Projects\C++\xxx\trunk\vc10\xxx\mysqlpp_d.lib(mysqlpp_d.dll) xxxxx
Error 14 error LNK2005: "public: void __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::`vbase destructor'(void)" (??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ) already defined in xxxxx.obj C:\Users\root\Documents\Visual Studio 2010\Projects\C++\xxx\trunk\vc10\xxxx\mysqlpp_d.lib(mysqlpp_d.dll) xxx
这些错误是否有解决方案?
BTW:我编译了整个mysql ++ libary而没有改变任何编译配置。
答案 0 :(得分:1)
在项目属性中定义MYSQLPP_NO_DLL-&gt; C / C ++ /预处理器
答案 1 :(得分:0)
尝试在项目选项中设置/ NODEFAULTLIB参数 - &gt;链接器/输入