这是makefile
all:server SERVER_OBJ
.PHONY: all clean
CXX ?= g++
DEBUG ?= 1
ifeq ($(DEBUG), 1)
CXXFLAGS += -g
else
CXXFLAGS += -O2
endif
SERVER_OBJ: main.o\
timer/timer.o\
http/httpconn.o\
log/log.o\
CGImysql/connpool.o\
server:${SERVER_OBJ}
$(CXX) -o server $^ $(CXXFLAGS) -lpthread -I/usr/include/cppconn -lmysqlcppconn
当我在终端输入'make'时,出现错误
g++ -o server -g -lpthread -I/usr/include/cppconn -lmysqlcppconn
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [Makefile:26: server] Error 1
关于为什么我可能会收到此错误的任何想法?谢谢!
我无法修复错误。