C++ CMake 错误:CMake 无法找到与“MinGW Makefiles”相对应的构建程序

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

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles"

c++cmakebox2d

提问by Starfruit

I am trying to use cmake to build the Box2D library for c++. When I run cmake gui I get the error:

我正在尝试使用 cmake 为 C++ 构建 Box2D 库。当我运行 cmake gui 时出现错误:

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!

Most questions like these people have answered by saying "Add MinGw/bin to the PATH" but I already have that on the PATH. What else could be causing this error?

大多数像这些人这样的问题都通过说“将 MinGw/bin 添加到 PATH”来回答,但我已经在 PATH 上有了它。还有什么可能导致此错误?

回答by jdonald

mingw32-make.execan be installed with the standard MinGW32 installer via the appropriate checkbox:

mingw32-make.exe可以通过相应的复选框与标准 MinGW32 安装程序一起安装:

MinGW32 Installation Manager screenshot

MinGW32 安装管理器截图

As rubenvb points out, you'll still need to ensure that it makes it into your PATH. If you edit your environment variables via System Properties, be sure to close and reopen the CMake GUI.

正如 rubenvb 指出的那样,您仍然需要确保它进入您的 PATH。如果您通过系统属性编辑环境变量,请务必关闭并重新打开 CMake GUI。

If you're more accustomed to using make.exe, install MSYS and use MSYS Makefilesas the CMake generator. You'll also need to put both mingw\binand msys\1.0\bininto your PATH.

如果您更习惯使用make.exe,请安装 MSYS 并使用MSYS Makefiles作为 CMake 生成器。您还需要将 mingw\bin和 都msys\1.0\bin放入您的路径中。

回答by Chamila Maddumage

I had the same problem and I added these three to my system path and errors were solved.

我遇到了同样的问题,我将这三个添加到我的系统路径中,错误就解决了。

C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin

C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin

C:\Program Files\CMake\bin

C:\Program Files\CMake\bin

C:\opencv\build\install\x64\mingw\bin

C:\opencv\build\install\x64\mingw\bin