|
发表于 2020-7-28 14:30:01
|
显示全部楼层
主要看libmysqlclient.a在那个目录下,例如我的在/usr/local/mysql/lib下,相应的include 在/usr/local/mysql/include下,那么makefile可以这样写:
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
这样写了以后,源代码的<mysql/mysql.h>要改为<mysql.h>,因为在makefile中已经指明了mysql.h的位置了。
|
|