mysql 静态链接,在C / C ++中静态链接MySQL

I am trying to develop an application that uses MySQL using C++. I downloaded the library from their website and I have attempted to compile the following code:

#include

#include

#include

using namespace std;

int main()

{

MYSQL *connection, mysql;

MYSQL_RES *result;

MYSQL_ROW row;

mysql_init(&mysql);

}

The line that has mysql_init(&mysql); gives me a compilation error

undefined reference to `mysql_init@4'

I am guessing this is due to a library error. I am linking mysqlclient.lib and libmysql.lib in that order. What do I need to do to make this compile without requiring a dll file? Is that possible? Thank you.

Note: I am using mingw32 on Windows 7 x64 to develop an application for Windows.

解决方案

Maybe this link will help. It states that mysqlclient.lib is the static library and libmysql.lib is the dynamic library, so I don't think you should be linking both.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值