|
It mainly depends on which directory libmysqlclient.a is in. For example, mine is under /usr/local/mysql/lib, and the corresponding include is under /usr/local/mysql/include. Then the makefile can be written like this:
CC=gcc
INCLUDES = -I/usr/local/mysql/include
LIBS = -L/usr/local/mysql/lib -lmysqlclient -lz
example:example.o
CC -o -g example example.o $(LIBS)
example.o:example.c
CC $(INCLUDES) -c -g example.c
After this is written, the source code of <mysql/mysql.h> should be changed to <mysql.h>, because the location of mysql.h has been specified in the makefile. |
|