我正在尝试将 MySQL Connector/C++ 添加到我的 Visual Studio 2010 项目中。
我按照步骤(这里,mysql docs)将其添加到 Visual Studio(我还在“其他包含目录”中添加了 Boost)。
它要求一个“sqlstring.h”文件(一个版本怎么会错过一个文件?!),所以我从源文件(mysql源档案)中得到它。
然后,它要求 libmyql.lib,我有 MySQL Server 5.5\lib 的 lib 目录。
现在,我遇到了这个错误:
错误 127 错误 LNK1120:31 个未解析的外部 C:\Users\Haks\Documents\Visual Studio 2010\Projects\ProductManager\Debug\ProductManager.exe ProductManager
错误 60 错误 LNK2001:无法解析的外部符号
"__declspec(dllimport) bool __cdecl std::operator<<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??$?MDU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@0@Z)
C:\Users\Haks\Documents\Visual Studio 2010\Projects\ProductManager\ProductManager\mysqlcppconn-static.lib(mysql_ps_resultset.obj) ProductManager
所以,也许是因为我得到了 MySQL Connector/C++ 1.1 的二进制版本,也许它与 VS 2010 不兼容......
但是我没有找到编译源文件的好方法,而且我从不使用 Boost 或 CMake,而且似乎需要它。
我发现没有提到我的问题,所以如果有人得到回应或一个好的方法,这对我和我认为的很多人都会非常有用。
谢谢