我尝试为c项目包含一些文件。但汇编不会奏效。我认为错误发生在这个makefile中。
CC=gcc
INCLUDES = -I/usr/include/mysql -I/usr/include/postgresql
LIBS = -lmysqlclient -/usr/lib
CFLAGS=-I$(INC)
LDLIBS=-L$(LIB) -lpq
ALL = pgconn
all: $(ALL)
clean: @rm -f *.o *~ $(ALL)
我觉得这个错误很明显,但我觉得自己很失明。
感谢答案。
编辑:
总之,我尝试:
包括: - / usr / include / mysql / - / usr / include / postgresql / Libarys - lmysqlclient - / usr / lib
我尝试将文件pgconn.c编译为可执行文件pgconn
我希望这能回答你的问题。
CC=gcc
INCLUDES = -I/usr/include/mysql -I/usr/include/postgresql
LIBS = -lmysqlclient -/usr/lib
CFLAGS=-I$(INC)
LDLIBS=-L$(LIB) -lpq
ALL = pgconn
all: pgconn
pgconn.o: pgconn.c
$(CC) -c $(INCLUDES) pgconn
pgconn:pgconn.o
$(CC) -o pgconn pgconn.o $(LIBS)
clean: @rm -f *.o *~ $(ALL)
错误消息:
gcc -c -I/usr/include/mysql -I/usr/include/postgresql pgconn
gcc: warning: pgconn: linker input file unused because linking not done
gcc -o pgconn pgconn.o -lmysqlclient -/usr/lib
gcc: error: pgconn.o: No such file or directory
gcc: error: unrecognized option ‘-/usr/lib’
make: *** [pgconn] Error 1
但是这个目录存在......