CLion: Error: C compiler "C: /MinGW/bin/gcc.exe" cannot compile a simple test program

I try to run CLion on Windows 7 using MinGW, but for some reason CMake cannot compile a simple test program, but when I create a simple hello world file, it compiles just fine when I call the compiler directly, not CMake.

I have already tried several versions of MinGW, but that does not make any difference to the error. I even deleted my AV to make sure that this is a problem, but once again nothing has changed.

I have MinGW on my way and CMake. At first I thought it might be a permissions issue in the TEMP folder, but they all look fine. I am also in the administrator account.

This is the error I get in CLion:

Error: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/Jim/.clion10/system/cmake/generated/4cb6a70c/4cb6a70c/__default__/CMakeFiles/CMakeTmp Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTryCompileExec141319549/fast" C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTryCompileExec141319549.dir\build.make CMakeFiles/cmTryCompileExec141319549.dir/build mingw32-make.exe[1]: Entering directory 'C:/Users/Jim/.clion10/system/cmake/generated/4cb6a70c/4cb6a70c/__default__/CMakeFiles/CMakeTmp' "C:\Program Files (x86)\JetBrains\CLion 1.0\bin\cmake\bin\cmake.exe" -E cmake_progress_report C:\Users\Jim\.clion10\system\cmake\generated\4cb6a70c\4cb6a70c\__default__\CMakeFiles\CMakeTmp\CMakeFiles 1 CMakeFiles\cmTryCompileExec141319549.dir\build.make:56: recipe for target 'CMakeFiles/cmTryCompileExec141319549.dir/testCCompiler.c.obj' failed process_begin: CreateProcess(C:\Users\Jim\AppData\Local\Temp\make68804-1.bat, C:\Users\Jim\AppData\Local\Temp\make68804-1.bat, ...) failed. make (e=2): Het systeem kan het opgegeven bestand niet vinden. mingw32-make.exe[1]: *** [CMakeFiles/cmTryCompileExec141319549.dir/testCCompiler.c.obj] Error 2 mingw32-make.exe[1]: Leaving directory 'C:/Users/Jim/.clion10/system/cmake/generated/4cb6a70c/4cb6a70c/__default__/CMakeFiles/CMakeTmp' Makefile:117: recipe for target 'cmTryCompileExec141319549/fast' failed mingw32-make.exe: *** [cmTryCompileExec141319549/fast] Error 2 CMake will not be able to correctly generate this project. 

This is the error I get when I try to use CMake from CMD: enter image description here

+7
gcc mingw cmake clion
source share
2 answers

With the dummy cmake project (A CMakeLists.txt with just cmake_minimum_required(VERSION 2.8) and add_executable(helloWorld <your hello world program>) .) We found that the compiler and CLion are not a problem, so there’s probably something to do with make . There was a magazine.

I assume you have msys in your way. If sh.exe is in your path, this is known to cause problems .

As a safe alternative, you can use ninja as an alternative to make (cmake supports it experimentally , but in practice it supports it very well). Here you can find ready-made packages (in fact, this is just one executable file that you must enter in your path).

CLion's ninja integration should work just fine .

+1
source share

I had a similar problem. Do you have MinGW installed before CLion?

If you just installed the C compiler with MinGW (the base), there is a chance that CLion checks for a non-existent C ++ compiler.

You should try installing the MinGW C ++ compiler from its installation manager. Or you can simply delete the C: \ MinGW folder and run the installer again, adding both the C and C ++ compilers. If this does not work, try reinstalling CLion.

This is a quick fix that worked for me.

0
source share

All Articles