0

我只包括

#include "include/mysql.h"

并尝试连接我的 mysql 数据库

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'
4

0 回答 0