Reputation: 459
I am trying to use cmake to build the Box2D library for c++. When I run cmake gui I get the error:
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?
Upvotes: 33
Views: 83139
Reputation: 31
If one using codelite and installed cmake plugin and set the arguments for cmake -G "MinGW Makefiles" and still don't working, just delete the workspace and restart the IDE and restart a new workspace. That worked for me.But I don't know whether just restarting the IDE works also not the deleting workspace thing. It will be wise to first restart the IDE and it still don't work then go to my method.
Upvotes: 0
Reputation: 31
If you changed the file named mingw32-make.exe
into make.exe
for convenience, you have to make a copy of make.exe
and rename it into mingw32-make.exe
.
I think cmake won't recognize make.exe
but mingw32-make.exe
.
Upvotes: 0
Reputation: 739
You can check this answer: https://stackoverflow.com/a/74240235/3110429
Firstly check the system.
Install MINGW https://www.msys2.org/
Install gcc, g++, gdb, and cmake using pacman.
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-cmake
Check installation:
gcc --version
g++ --version
gdb --version
Edit environment variables for your account (PATH)
C:\msys64\mingw64\bin
For cmake project on Vscode:
Create a cmake project: https://code.visualstudio.com/docs/cpp/cmake-linux#_create-a-cmake-project
Choose the Kit (Toolchain) which was installed before
Set cmake.cmakePath (If you installed with pacman, the path should be same as gcc/g++.
"cmake.cmakePath": "C:\msys64\mingw64\bin\cmake.exe"
Reset VScode: Ctrl+shift+P and type "CMake:Reset CMake Tools for Extension State"
Configure project: Ctrl+shift+P and type "CMake: Configure". You will see "built" directory and generated files.
Upvotes: 6
Reputation: 21
In the path MinGW\bin
try to find make.exe
or mingw32-make.exe
. If you don't have it then mingw32-make.exe
can be installed with the standard MinGW32
installer as shown in the pervious answer.
Then have a second copy of make.exe
or mingw32-make.exe
to have identical two files with those names make.exe
and mingw32-make.exe
and it solved my problem.
Upvotes: 2
Reputation: 3866
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\CMake\bin
C:\opencv\build\install\x64\mingw\bin
Upvotes: 2
Reputation: 716
mingw32-make.exe
can be installed with the standard MinGW32 installer via the appropriate checkbox:
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.
If you're more accustomed to using make.exe
, install MSYS and use MSYS Makefiles as the CMake generator. You'll also need to put both mingw\bin
and msys\1.0\bin
into your PATH.
Upvotes: 18