2
votes

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(?)

4

4 Answers

1
votes

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.

1
votes

your windows 64bit and you can't write gcc.exe and g++.exe in windows 64 . you should try installing mingw-w64.

you can download this From here and installing this.

after that you should go in CLion setting -> build,Execution,deployment -> Toolchains

and configuration like this picture

and for installer mingw-w64 you should installer default option.

0
votes

open the MinGW Installation Manger,and choose all the items under the path of All packages/MinGW/MinGW Base System to installation.

0
votes

I keep going back to this question every now and then when I encounter the same error, although the cause of it in my cases is not present in any of the previous answers. In general, MinGW package (or CMake, whichever it is) does not like it when either it or file(s) we want it to work with is placed in a path with non-latin characters. Changing the directory of the project and / or MinGW installation solves the issue every time.