C++ makefile 错误,(.text+0x24):未定义对“main”的引用[关闭]

问题描述 投票:0回答:0

这是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

关于为什么我可能会收到此错误的任何想法?谢谢!

我无法修复错误。

c++ makefile
© www.soinside.com 2019 - 2024. All rights reserved.