Mysql C API linking failure
First this is a C programming project under linux, :blush:
I attached the source code file here, including :
dbop.h
dbop.c
main.c
makefile
Mysql is installed in this directory : /usr/local/mysql
the "include file" and "lib" can be found in this folder. So I add the -I$(inc) and -L($lib) to the gcc flags. But when I make it from terminal, the errors appear:
[root@localhost program]# make
gcc -c main.c -I/usr/local/mysql/include
gcc -c dbop.c -I/usr/local/mysql/include -L/usr/local/mysql/lib
gcc -g -o main main.o dbop.o -L/usr/local/mysql/lib
dbop.o(.text+0x30): In function `db_init':
: undefined reference to `mysql_init'
dbop.o(.text+0x5a): In function `db_init':
: undefined reference to `mysql_options'
dbop.o(.text+0xb1): In function `db_connect':
: undefined reference to `mysql_real_connect'
dbop.o(.text+0x25e): In function `db_close':
: undefined reference to `mysql_close'
dbop.o(.text+0x29d): In function `db_query':
: undefined reference to `mysql_query'
.....
That is to say, the Mysql API can't be found. Please help to check the makefile, is this file wrong ?
or what the reason can be ?
Thank you very much !
wxuf

