On Sun, Dec 05, 2010 at 11:36:12PM +0800, 刘昆 wrote:
> To be specific,I want add "/usr/include/mysql/mysql.h" header file and
> link "libmysqlclient.so" lib to do my work. So how should I do to?
The quickest way would be to set some environment variables before you
run the configure script. According to configure --help, you can set
"LIBS" to set the "libraries to pass to the linker" and CPPFLAGS to pass
the include directory for mysql to the C preprocessor. If the mysql
library isn't in a standard place on your system, you can pass an
additional library directory with LDFLAGS.
For example:
(csh/tcsh)
setenv LDFLAGS -L/usr/local/lib/mysql
setenv LIBS -lmysqlicient
setenv CPPFLAGS -I/usr/include/mysql
(sh/bash/etc)
export LDFLAGS=-L/usr/local/lib/mysql
export LIBS=-lmysqlclient
export CPPFLAGS=-I/usr/include/mysql
(You may not need to set LDFLAGS)
Then in packet-http.c, just do "#include <mysql/mysql.h>" and use the
functions provided by MySQL.