【发布时间】:2011-07-03 22:58:14
【问题描述】:
我正在尝试将 MySQL Connector/C++ 添加到我的 Visual Studio 2010 项目中。
我按照步骤 (here, mysql docs) 将其添加到 Visual Studio(我还在“其他包含目录”中添加了 Boost)。
它要求一个“sqlstring.h”文件(一个版本怎么会错过一个文件?!),所以我从源文件中得到它(mysql source archives)。
然后,它要求 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,而且似乎需要它。
我没有发现任何关于我的问题的参考,所以如果有人得到回应或一个好的方法,这对我和我认为的很多人都会非常有用。
谢谢
【问题讨论】:
-
按照与您相同的教程,遇到同样的问题:) 在这里:forge.mysql.com/wiki/Connector_C%2B%2B,它说:[完成]准备对 Visual Studio 2010 的支持,所以下一个版本可能会支持 2010。
标签: c++ mysql database visual-studio-2010 mysql-connector