Mysql with C++ error: undefined reference to mysql_init

后端 未结 3 1828
眼角桃花
眼角桃花 2021-01-06 04:02
#include 
#include 

#include 


int main (int argc, char *argv[])
{

MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;

         


        
3条回答
  •  情书的邮戳
    2021-01-06 04:33

    This is for Linux environments only:

    In "Project build options" > "Linker settings" Tab > Under "Other linker options" add -lmysqlclient

    enter image description here

    You will also need to add mysql-connector-c-6.1.3-linux-glibc2.5-x86_64/include/ in "Search directories" > "Compiler"

    enter image description here

    You will also need to add mysql-connector-c-6.1.3-linux-glibc2.5-x86_64/lib/ in "Search directories" > "Linker"

    enter image description here

    For windows:

    -lmysql

    MySQL Connector library can be found here: http://dev.mysql.com/downloads/connector/c/

提交回复
热议问题