我正在使用mingw32实现gnu-make将C++应用程序从Linux移植到Windows。
mingw32-make.exe可以正确编译应用程序,就像在Linux上一样,但出于某些原因,clean命令不起作用。makefile的相关部分是:
#Where temporary object files are stored
ODIR=obj
#Where the final application is stored
OUTDIR=bin
OUTNAME=application.exe
...
.PHONY: clean
clean:
rm -Force ./$(OUTDIR)/$(OUTNAME)
rm -Force ./$(ODIR)/*.o在windows终端中键入mingw32-make clean将提供以下输出。
rm -Force ./bin/application.exe
process_begin: CreateProcess(NULL, rm -Force ./bin/application.exe, ...) failed.
make (e=2): The system cannot find the file specified.
makefile:37: recipe for target 'clean' failed
mingw32-make: *** [clean] Error 2但是,如果我手动输入命令,它的工作原理是完全正确的:
rm -Force ./bin/application.exe
rm -Force ./obj/*.o然后有问题的文件就不见了。
但这正是mingw32-make所说的不可能,我知道问题不在于常量OUTDIR、ODIR或OUTNAME是错误的,因为mingw32-make可以很好地编译程序并将其放置在正确的位置。
有什么区别,使没有权限删除文件?
https://stackoverflow.com/questions/72920746
复制相似问题