我有一个相当简单的makefile,但它在链接所有.o时崩溃以构建myprogram可执行文件。
这是错误消息:
make: Circular myprogram <- myprogram dependency dropped.
g++ -o .cpp
g++: no input files
make: *** [.cpp] Error 1
这是makefile:
CODE = myprogram
OBJS = /home/Documents/Obj/object1.o /home/Documents/Obj/object2.o /home/Documents/Obj/object3.o /home/Documents/Obj/object4.o
default: $(CODE)
C = g++ $(CXXFLAGS) -fopenmp -g
INCLUDE = -I/home/Documents/Include/
LIBS = -lfftw3 -lm $(LIB)
%.o: %.cpp
$(C) $(INCLUDE) -c -o $@ $<
$(CODE): $(OBJS) $(CODE).cpp
$(C) $(INCLUDE) -o $(CODE) $(CODE).cpp $(OBJS) $(LIBS)
clean:
- $(RM) $(CLEAN) $(CODE) $(OBJS)