我只是包括
#include "include/mysql.h"
并尝试连接我的mysql db
MYSQL_RES *result;
MYSQL_ROW row;
MYSQL *connection, mysql;
int state;
mysql_init(&mysql);
connection = mysql_real_connect(&mysql,"localhost","root","pass","WorkerProject",0,0,0);
我将文件包含在我的项目中。我使用eclipse并从项目的preporties链接mysql bin,include和lib文件。但是,我在这两行中得到错误:
mysql_init(&mysql);
connection = mysql_real_connect(&mysql,"localhost","root","pass","WorkerProject",0,0,0);
未定义的引用错误。为什么呢?
错误:
/home/mert/workspace1/Project484/Debug/../src/main.cpp:99: undefined reference to `mysql_init'
/home/mert/workspace1/Project484/Debug/../src/main.cpp:100: undefined reference to `mysql_real_connect'