简体   繁体   English

Makefile | Make 后清理 - 错误:没有这样的文件或目录 | 错误:目标配方 * 失败

[英]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.虽然,我的问题类似于以下帖子,但他们的解决方案显然没有效果。

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.

相关问题 无法制作 raylib,收到 makefile 错误 576:目标“rmodels.o”的配方失败 - Can't make raylib, receives makefile error 576: recipe for target 'rmodels.o' failed 单目总捕获编译过程错误:Makefile:83:目标'CMakeFiles/mylib.dir/all'的配方失败 - Monocular Total Capture compilation process error : Makefile:83: recipe for target 'CMakeFiles/mylib.dir/all' failed suriyaaOS - Windows 10 上的 Cygwin - Makefile-error: 目标“modules/ext2.o”的配方失败 - suriyaaOS - Cygwin on Windows 10 - Makefile-error: recipe for target 'modules/ext2.o' failed makefile错误没有这样的文件或目录 - makefile error no such file or directory Makefile错误:没有这样的文件或目录 - Makefile error: No such file or directory 目标“全部”的 CMake 配方失败。 库错误 - CMake recipe for target 'all' failed. Library error 为什么makefile返回g ++:错误:h文件或目录make:*** [Makefile:12:test]错误1? - Why is the makefile returning g++: error: h file or directory make: *** [Makefile:12: test] Error 1? 错误:没有那个文件或目录:编译makefile后'--std=c++11' - Error: no such file or directory: '–std=c++11' after compiling makefile C ++ Makefile错误:没有规则来制作目标 - C++ Makefile error: No rule to make target Makefile失败,并显示错误,没有规则可作为目标 - Makefile fails with error no rule to make target
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM