get_mysql_driver,MySQL C ++连接器未解析的外部符号_get_driver_instance

I'm using Connector C++ 1.1.3 on Win 8 with VS 2010 Express.

For my debug build in Linker->General->Additional Library Directories I have: C:\Program Files\MySQL\Connector C++ 1.1.3\lib\debug

In Linker->Input I have: mysqlcppconn.lib

I get linker error: Server.obj : error LNK2019: unresolved external symbol _get_driver_instance referenced in function "public: bool __thiscall Server::Init(void)" (?Init@Server@@QAE_NXZ)

I have boost in additional include directorys : C:\Users\MyName\Downloads\boost_1_55_0\boost_1_55_0

I would assume get_driver_instance() is defined in the mysqlcppconn.lib.

#include

#include

#include

#include

class Server

{

private:

sql::Driver* sqlDriver;

sql::Connection* sqlConn;

public:

bool Init();

};

bool Server::Init()

{

sqlDriver = get_driver_instance();

return true;

}

I know there are a bunch of topics on this but nothing I've tried has solved it. I haven't written all the things I've tried down as there are a bunch of things.

解决方案

I had the same problem and ended up solving it by switching to "Release" instead of "Debug".

Other related problems are solved by this small change. (See Connection Crash in mysql C++ )

I understand that you solved this using Qt library, but I guess this can help for other people that got stuck in the same place.

Edit:

I've been doing some research on the mysql site (http://dev.mysql.com/downloads/connector/cpp/) and it clearly states that:

One problem that can occur is when the tools you use to build your application are not compatible with the tools used to build the binary versions of MySQL Connector/C++. Ideally, you need to build your application with the same tools that were used to build the MySQL Connector/C++ binaries.

The solution I've found so far is to download the library in source format (not binary) and compile it with the settings I need.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值