我在makefile中遇到以下错误:
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o:在函数 _start': (.text+0x20): undefined reference to
main ' collect2: error: ld returned 1 exit status makefile:7: recipe for target ' runme'失败make:*** [runme]错误1
这是我的makefile代码:
CXXFLAGS+=-std=c++11
OBJ=main.o Shape.o
all: runme
runme: main.o Shape.o
g++ $(OBJ) $(CXXFLAGS) -o runme
main.o: main.cpp Shape.hpp
g++ $(CXXFLAGS) main.cpp -o main.o
Shape.o: Shape.hpp Shape.cpp
g++ $(CXXFLAGS) Shape.cpp -o Shape.o
clean:
rm -f *.o
distclean: clean
rm -f runme