Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 配方在第一个目标之前开始。停止在运行makefile时_C++_Makefile_G++_Executable - Fatal编程技术网

C++ 配方在第一个目标之前开始。停止在运行makefile时

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

我已经在这个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
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)$(前任)