参考: feizf.blogbus.com/logs/30689586.html
命令:
#安装开发包
sudo apt-get install libmysqlclient15-dev
相关mysql头文件和库文件安装在/usr/include/mysql/和/usr/lib/mysql目录
编译操作数据库的C源文件命令是:
gcc demo.c -I /usr/include/mysql -L /usr/lib/mysql -lmysqlclient -o demo
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
测试开发环境是否搭建好的代码:
#include<stdlib.h>
#include<mysql.h>
/*
* compile command:
* gcc test.c -I /usr/include/mysql -L /usr/lib/mysql -lmysqlclient -o test
*/
int main()
{
MYSQL mysql;
mysql_init(&mysql);
return 0;
}