Error: Clion 2020.2 / The C compiler is not able to compile a simple test program

Answered

Clion 2020.2 Build #CL-202.6397.106

Windows 10 64 bits

Sorry, I don't speak fluent English.

Please be patient and help me!

------

I installed the latest version of MinGW and Clion.

 

When starting any new project after installation, the following message appear...

 

code:

C language

#include <stdio.h>

int main() {
printf("Hello, World!\n");
return 0;
}

message in cmake:

"C:\Program Files\JetBrains\CLion 2020.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" "D:\Conhecimento\Puc Minas\20202\AEDII\Exercícios\teste"
-- The C 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 2020.2/bin/cmake/win/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (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: D:/Conhecimento/Puc Minas/20202/AEDII/Exercícios/teste/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):C:/MinGW/bin/mingw32-make.exe cmTC_be721/fast && C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_be721.dir\build.make CMakeFiles/cmTC_be721.dir/build
mingw32-make.exe[1]: Entering directory 'D:/Conhecimento/Puc Minas/20202/AEDII/Exerc�cios/teste/cmake-build-debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_be721.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_be721.dir\testCCompiler.c.obj -c "D:\Conhecimento\Puc Minas\20202\AEDII\Exercícios\teste\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c"
gcc.exe: error: D:\Conhecimento\Puc Minas\20202\AEDII\Exerc+ícios\teste\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
CMakeFiles\cmTC_be721.dir\build.make:84: recipe for target 'CMakeFiles/cmTC_be721.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_be721.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'D:/Conhecimento/Puc Minas/20202/AEDII/Exerc�cios/teste/cmake-build-debug/CMakeFiles/CMakeTmp'
Makefile:140: recipe for target 'cmTC_be721/fast' failed
mingw32-make.exe: *** [cmTC_be721/fast] Error 2

 

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


-- Configuring incomplete, errors occurred!
See also "D:/Conhecimento/Puc Minas/20202/AEDII/Exercícios/teste/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "D:/Conhecimento/Puc Minas/20202/AEDII/Exercícios/teste/cmake-build-debug/CMakeFiles/CMakeError.log".

[Finished]

 

 

 

 

 

 

 

 

 

 

1
3 comments

Hello!

It's not a CLion's problem, but a problem with using CMake + MinGW - they don't support non-latin symbols.

To solve the problem please do the following:

1. Create temp folder in location which path doesn't include non-latin symbols (for example, `C:\tmp`).
2. In CLion menu select `Help | Edit Custom VM options...`.
3. In the opened file add this line: `-Djava.io.tmpdir=<path_to_temp_folder>` (for example, `-Djava.io.tmpdir=C:/tmp`).
4. In the menu do `File | Save All`.
5. Restart CLion.

Also if path to your project contains non-latin symbols, please move the CMake generation directory to a path that doesn't contain such characters (either via `File | Settings | Build, Execution, Deployment | CMake | Generation path`, or just put the project itself to other location).

-1

Please sign in to leave a comment.