Compile command for c mysql program under Linux

  
 

It is best to use #gcc -o test test.c `mysql_config --cflags --libs` other compile commands: #gcc -o test test.c -I/usr/include/mysql -L/usr/lib /mysql -lmysqlclient -lz -lm#gcc -o test test.c -I /usr/include/mysql -L /usr/lib/mysql -l mysqlclient -lz -lm

mysql_config: Get compiled clients The compile option mysql_config provides useful information about compiling the MySQL client and connecting it to MySQL. The following options are supported: --cflags: compiler flags for finding include files and key compilers to use when compiling the libmysqlclient library Flags and definitions.--include: compiler options for finding MySQL include files (note that normally, use "--cflags" instead of this option).--libmysql-libs, --enbedded: and The libraries and options required to connect to the MySQL embedded server. --libs: The libraries and options needed to connect to the MySQL client library. --libs_r: The libraries and options needed to link to the thread-safe MySQL client. --port: The default tcp/ip port number, defined when configuring MySQL.--socket: The default Unix socket file, defined when configuring MySQL. --version: version number and version of the MySQL distribution. Among them, mysql_config is in /usr/bin/mysql_config (this is the default directory after the rpm package is installed). If the source is installed, it is usually in ..../mysql/bin /mysql_config.

Copyright © Windows knowledge All Rights Reserved