C++ 配方在第一个目标之前开始。停止在运行makefile时
我已经在这个makefile上工作了几个小时,我不知道我做错了什么。我试图制作六个不同的可执行文件(Q1-Q6),但我一直得到上面所述的错误。这是我的密码C++ 配方在第一个目标之前开始。停止在运行makefile时,c++,makefile,g++,executable,C++,Makefile,G++,Executable,我已经在这个makefile上工作了几个小时,我不知道我做错了什么。我试图制作六个不同的可执行文件(Q1-Q6),但我一直得到上面所述的错误。这是我的密码 BUILD_FLAGS= -W -Wall -pedantic CC=g++ RM=rm EXES=*.exe OBJECTS=*.o g++ -c Question1.cpp g++ -c Question2.cpp g++ -c Question3.cpp g++ -c Question4.cpp g++ -c Question5.cpp
BUILD_FLAGS= -W -Wall -pedantic
CC=g++
RM=rm
EXES=*.exe
OBJECTS=*.o
g++ -c Question1.cpp
g++ -c Question2.cpp
g++ -c Question3.cpp
g++ -c Question4.cpp
g++ -c Question5.cpp
g++ -c Question6.cpp
g++ -o Question1.exe Question1.o
g++ -o Question2.exe Question2.o
g++ -o Question3.exe Question3.o
g++ -o Question4.exe Question4.o
g++ -o Question5.exe Question5.o
g++ -o Question6.exe Question6.o
clean:
$(RM)$(EXES)$(OBJECTS)
试试下面的方法
BUILD_FLAGS=-W -Wall -pedantic
CC=g++
RM=rm
EXES=*.exe
OBJECTS=*.o
all: Question1.exe Question2.exe Question3.exe Question4.exe Question5.exe Question6.exe
%.exe: %.cpp
g++ ${BUILD_FLAGS} -o $@ $<
clean:
$(RM) $(EXES)
BUILD_FLAGS=-W-Wall-pedantic
CC=g++
RM=RM
EXES=*.exe
对象=*.o
全部:Question1.exe Question2.exe Question3.exe Question4.exe Question5.exe Question6.exe
%.exe:%.cpp
g++${BUILD_FLAGS}-o$@$<
清洁:
$(RM)$(前任)