CLion + MinGW Test CMake run finished with errors

cliong++gcc

I'm new on this IDE, and programming on Windows, I've installed MinGW and added to enviroment path all is ok, I can compile and execute code from "cmd", but when I run CLion I have this error:

— The C compiler identification is GNU 6.3.0
— The CXX compiler identification is GNU 6.3.0
— Check for working C compiler: C:/MinGW/bin/gcc.exe
— Check for working C compiler: C:/MinGW/bin/gcc.exe — broken
CMake Error at C:/Program Files/JetBrains/CLion 2017.3.1/bin/cmake/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test
program.

It fails with the following output:

Change Dir: C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp

Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_2e43b/fast"

C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_2e43b.dir\build.make
CMakeFiles/cmTC_2e43b.dir/build

mingw32-make.exe1: Entering directory
'C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'

CMakeFiles\cmTC_2e43b.dir\build.make:64: recipe for target
'CMakeFiles/cmTC_2e43b.dir/testCCompiler.c.obj' failed

process_begin:
CreateProcess(C:\Users\noName\AppData\Local\Temp\make2428-1.bat,
C:\Users\noName\AppData\Local\Temp\make2428-1.bat, …) failed.

make (e=2): El sistema no puede encontrar el archivo especificado.

mingw32-make.exe1: *** [CMakeFiles/cmTC_2e43b.dir/testCCompiler.c.obj]
Error 2

mingw32-make.exe1: Leaving directory
'C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'

Makefile:125: recipe for target 'cmTC_2e43b/fast' failed

mingw32-make.exe: *** [cmTC_2e43b/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)

— Configuring incomplete, errors occurred!
See also "C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".

Error code: 1

This is the photo. I think this is and error with CMake(?)

Best Answer

I encountered the same problem with mingw-32. Here is my solution.

First I removed all packages through MinGW Installer. Then as Jetbrains quick tutorial suggests I went to this page to download MingW-W64-builds. Installed it as x86_64. Under Toolchain | Environment clicked ... after the first dropdown slot, specified the folder called mingw64 under my installation. MinGW version should be "w64 5.0". This time no error report and Make, C compiler and C++ compiler were detected.

Related Topic