相對於window下的設定,linux要簡單的很多。
1. 示例程式
$ vi mysql-c-api.c
#include #include "mysql/mysql.h"
int main()
return 0;
}
2. 編譯命令
在mysql編譯後的二進位制檔案中,有乙個很有用的二進位制檔案「mysql_config」(一般和mysql命令在同乙個目錄下),我們可以通過這個程式找到需要的標頭檔案和連線庫:
$ gcc -o a.out $(mysql_config --cflags) mysql-c-api.c $(mysql_config --libs)
$ ./a.out
linux下C語言連線mysql
linux下c語言連線mysql include include include mysql mysql void doquery m res mysql store result mysql if m res null while m field mysql fetch field m res i...
Linux下C語言連線MySQL
include include include int main if mysql query mysql,select from test num fields mysql num fields result while row mysql fetch row result for i 0 i編譯...
linux下c語言udp連線例項
created by 冰糖葫蘆的夏天 on 16 7 15.server udp.c include include include include define listenport 12345 定義監聽埠號 define listenip 127.0.0.1 定義監聽ip位址 int main ...