[英]Makefile | Cleaning up after Make - Error: No such file or directory | Error: recipe for target * failed
Situation
情况
Attempting to cleanup after a Makefile compilation.尝试在 Makefile 编译后进行清理。
Errors
错误
These are the error(s) that I'm routinely receiving while attempting to conduct, one would believe to be, a simple cleanup operation.这些是我在尝试执行(人们认为是)简单的清理操作时经常收到的错误。
Errors:错误:
Command:
命令:
make linux
linux
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh find *.o -type f -delete
g++: error: find: No such file or directory
g++: error: f: No such file or directory
g++: error: unrecognized command line option ‘-type’; did you mean ‘-pipe’?
Command:
命令:
make linux
linux
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh rm -f *.o
g++: error: rm: No such file or directory
g++: error: unrecognized command line option ‘-f’
Command:
命令:
make linux
linux
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh clean
g++: error: clean: No such file or directory
Makefile:2: recipe for target 'linux' failed
Makefile
Makefile
linux: Main.o CHARACTER.o ATTRIBUTES.o
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh clean
(alternate command attempt)
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh -rm -f *.o
(alternate command attempt)
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh find *.o -type f -delete
win32: Main.o CHARACTER.o ATTRIBUTES.o
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.exe cleanWin
main.o: Main.cpp
g++ -c Main.cpp
CHARACTER.o: src/CHARACTER.cpp include/CHARACTER.h
g++ -c src/CHARACTER.cpp
ATTRIBUTES.o: src/ATTRIBUTES.cpp include/ATTRIBUTES.h
g++ -c src/ATTRIBUTES.cpp
clean:
rm -f *.o
cleanWin:
del *.o
Summary
概括
Everything except the cleanup routine works apparently fine, however, once cleanup is attempted, I errors for functions that are definitely accessible throughout my OS, whether Win32 or Linux.除了清理例程之外的所有内容显然都可以正常工作,但是,一旦尝试清理,我就会错误地发现在我的操作系统中绝对可以访问的功能,无论是 Win32 还是 Linux。 Can't quite understand why these simple commands are routinely having issues.
不太明白为什么这些简单的命令经常出现问题。
Similar Posts
类似帖子
Albeit, my issue is similar to the following post(s), their solution(s) apparently have no effect.虽然,我的问题类似于以下帖子,但他们的解决方案显然没有效果。
make clean
Makefile target make clean
Makefile 目标的“没有这样的文件或目录”错误Makefile No such file or directory Makefile 没有这个文件或目录
You are adding find *.o -type f -deletefind *.o -type f -delete
and the other cleanup commands as arguments to g++
.您正在将
find *.o -type f -deletefind *.o -type f -delete
和其他清理命令作为 arguments 添加到g++
。 Put ;
放
;
between commands.命令之间。 Example:
例子:
linux: Main.o CHARACTER.o ATTRIBUTES.o
g++ Main.o CHARACTER.o ATTRIBUTES.o -o bin/release/Player.sh ;
clean
Note that this target, linux
, doesn't actually produce a linux
file.请注意,此目标
linux
实际上不会生成linux
文件。 It will produce a binary file called bin/release/Player.sh
which is a really bad name for a binary file.它将生成一个名为
bin/release/Player.sh
的二进制文件,这对于二进制文件来说是一个非常糟糕的名称。 .sh
is usually reserved for shell scripts. .sh
通常为 shell 脚本保留。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.