C++ MinGW 和/或 MSYS 不再包含 make 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8334408/
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-08-28 18:23:24  来源:igfitidea点击:

Is make no longer included with MinGW and/or MSYS?

c++makefilemingwmsys

提问by Thomas Owens

I installed MinGW and MSYS on my Windows 7 computer. I added C:\Program Files (x86)\MinGW\binto my path. Commands such as gccand g++work, but makedoes not. I looked in the directory, and there is no executable called make, even though I installed all components. There is a file called mingw32-make. There are also other files prefixed with mingw32-, such as c++, g++, gcc, gcc-4.6.1, and gfortran. However, there is a makein C:\Program Files (x86)\MinGW\msys\1.0\bin.

我在 Windows 7 计算机上安装了 MinGW 和 MSYS。我添加C:\Program Files (x86)\MinGW\bin到我的路径。诸如gcc和 之类的命令g++有效,但make无效。我查看了目录,make即使我安装了所有组件,也没有名为 的可执行文件。有一个文件叫做mingw32-make. 还有其他以 为前缀的文件mingw32-,例如 c++、g++、gcc、gcc-4.6.1 和 gfortran。但是,有一个makein C:\Program Files (x86)\MinGW\msys\1.0\bin

If I open the MinGW Shell and type in make, make executes. However, it does not execute from the Windows terminal.

如果我打开 MinGW Shell 并输入make,make 就会执行。但是,它不会从 Windows 终端执行。

Is this intentional, or could I be missing other executables as well? Should I just add C:\Program Files (x86)\MinGW\msys\1.0\binto my path?

这是故意的,还是我也可能缺少其他可执行文件?我应该添加C:\Program Files (x86)\MinGW\msys\1.0\bin到我的路径中吗?

采纳答案by eriktous

Yup, add the msys bin directory to your path (after MinGW's bin dir). That's exactly what the MinGW shell does and why it works there.

是的,将 msys bin 目录添加到您的路径中(在 MinGW 的 bin 目录之后)。这正是 MinGW shell 的作用以及它在那里工作的原因。

回答by Greg Hewgill

Try gmake. Sometimes the GNU version of Make installs itself as gmakein order to distinguish from non-GNU Make.

试试gmake。有时 GNU 版本的 Make 会自行安装gmake以区别于非 GNU Make。

回答by Matthias Nowak

C:\Program files\xxx has spaces in it! Since shell scripts are involved, spaces are significant and have to be escaped. Hence this path will not work with mingw. The documentation recommends to install MingW in C:\MingW.

C:\Program files\xxx 里面有空格!由于涉及到 shell 脚本,所以空格很重要并且必须被转义。因此,此路径不适用于 mingw。文档建议将 MingW 安装在 C:\MingW 中。