简体   繁体   English

makefile错误没有这样的文件或目录

[英]makefile error no such file or directory

So this is my first time making a make file so its really basic. 所以这是我第一次制作make文件,因此它是非常基本的。 I have 2 cpp files (functions.cpp and main.cpp) and 2 header files (structDeclaration.h and Prototypes.h). 我有2个cpp文件(functions.cpp和main.cpp)和2个头文件(structDeclaration.h和Prototypes.h)。 It needs to be able to compile my program but if only one file changes then it shouldn't recompile the entire thing. 它需要能够编译我的程序,但是如果仅更改一个文件,则它不应重新编译整个程序。

heres my error: 这是我的错误:

g++ -c gradebook main.o Functions.o -I. g++: error: gradebook: No such file or directory make: *** [gradebook] Error 1 g++ -c gradebook main.o Functions.o -I. g++: error: gradebook: No such file or directory make: *** [gradebook] Error 1 and heres my makefile: g++ -c gradebook main.o Functions.o -I. g++: error: gradebook: No such file or directory make: *** [gradebook] Error 1g++ -c gradebook main.o Functions.o -I. g++: error: gradebook: No such file or directory make: *** [gradebook] Error 1我的makefile:

CC = g++

gradebook: main.o Functions.o 
    g++ -c gradebook main.o Functions.o -I.

main.o: main.cpp Prototypes.h structDeclaration.h Prototypes.h
    g++ -c main.cpp

Functions.o: Functions.cpp structDeclaration.h
    g++ -c Functions.cpp

the commands have to be valid commands. 这些命令必须是有效的命令。 I think you mean 我想你是说

g++ -o gradebook main.o Functions.o

If in doubt just try typing the command you are asking make to run for you, there is no magic involved here 如果有疑问,请尝试键入您要让make运行的命令,这里没有涉及任何魔术

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM