Windows 上的 Makefile 干净

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6222371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:58:42  来源:igfitidea点击:

Makefile clean on windows

windowsmakefile

提问by ameer

I'm learning about using makefiles now and I made the following makefile (I'm on windows using visual studio command line compiler)

我现在正在学习如何使用 makefile,并制作了以下 makefile(我在 windows 上使用 Visual Studio 命令行编译器)

CC = cl
CFLAG = /EHsc
test_database.exe: composer.obj database.obj test_database.obj
    $(CC) test_database.obj database.obj composer.obj
test_database.obj: test_database.cpp
    $(CC) $(CFLAGS) -c test_database.cpp
composer.obj: composer.cpp composer.h
    $(CC) $(CFLAGS) -c composer.cpp
database.obj: database.cpp database.h
    $(CC) $(CFLAGS) -c database.cpp

.PHONY : clean
clean:
    rm -f *.obj

Whenever I invoke make cleanI get make: Interrupt/Exception caught (code = 0xc00000fd, addr = 0x4ff283)I'm not quite sure what I'm doing wrong. I can use make to compile the program no problem I just get the error when I target clean. rmexists on my machine and is on the path as I use it all the time. I've tried it with DELas well with an identical error. Any help pointing me in the right direction would be appreciated.

每当我调用时,make clean我都make: Interrupt/Exception caught (code = 0xc00000fd, addr = 0x4ff283)不太确定自己做错了什么。我可以使用 make 编译程序没问题我只是在我瞄准干净时得到错误。rm存在于我的机器上并且在我一直使用它的路径上。我也尝试过,但DEL出现相同的错误。任何为我指明正确方向的帮助将不胜感激。

Make Version is GNU Make 3.80

制作版本是 GNU Make 3.80

回答by seva titov

The makefile you have is fine, "nmake clean" correctly invokes the command.

您拥有的 makefile 很好,“nmake clean”正确调用了命令。

The version on make you are using is not working. Your options is to either use nmake.exe utility that comes with Visual Studio or Windows SDK or get a version of make that works.

您使用的 make 版本不起作用。您的选择是使用 Visual Studio 或 Windows SDK 附带的 nmake.exe 实用程序,或者获取有效的 make 版本。

回答by Jon Thoroddsen

It's a bug in make, caused by parantheses in your PATH variable. See http://okolovich.info/interruptexception-caught-with-code-0xc00000fd/

这是 make 中的一个错误,由 PATH 变量中的括号引起。见http://okolovich.info/interruptexception-caught-with-code-0xc00000fd/

回答by Aleksei Fedotov

Recently, I faced the same problem. In my case it appears that escaping an asterisk (that is rm -rf \*.obj) solved the problem. Though my make version is a bit newer: GNU Make 3.81.

最近,我遇到了同样的问题。在我的情况下,转义星号(即rm -rf \*.obj)似乎解决了问题。虽然我的 make 版本有点新:GNU Make 3.81.