Search code examples
c++ccmakecompiler-errorsclion

How can I solve this compiling error on CLion?


I use as the main directory one called CLionProjects, on it I have several directories. Recently I added those directories so to organize my files. I used since the first time I installed CLion a directory called "Boletin1" that it's inside the main directory, later when I created "Boletin2" (In these directories I have the projects called Ejercicio1, Ejercicio2 and so on) the problems started showing up, I get this error message: I got to make clear that the compiler problem is only on "Boletin2" directory and the one called "Boletin1" works alright.

I type the debug:

"C:\Program Files\JetBrains\Nueva carpeta\CLion 2020.2.3\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\usuario\Desktop\CLionProjects\Boletín2\Ejercicio1
-- The C compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/JetBrains/Nueva carpeta/CLion 2020.2.3/bin/cmake/win/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "C:/mingw64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/usuario/Desktop/CLionProjects/Boletín2/Ejercicio1/cmake-build-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):C:/mingw64/bin/mingw32-make.exe cmTC_a9874/fast && C:/mingw64/bin/mingw32-make.exe  -f CMakeFiles\cmTC_a9874.dir\build.make CMakeFiles/cmTC_a9874.dir/build
    mingw32-make.exe[1]: Entering directory 'C:/Users/usuario/Desktop/CLionProjects/Bolet�n2/Ejercicio1/cmake-build-debug/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_a9874.dir/testCCompiler.c.obj
    C:\mingw64\bin\gcc.exe    -o CMakeFiles\cmTC_a9874.dir\testCCompiler.c.obj   -c C:\Users\usuario\Desktop\CLionProjects\Boletín2\Ejercicio1\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c
    gcc.exe: error: C:\Users\usuario\Desktop\CLionProjects\Boletín2\Ejercicio1\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
    gcc.exe: fatal error: no input files
    compilation terminated.
    mingw32-make.exe[1]: *** [CMakeFiles\cmTC_a9874.dir\build.make:85: CMakeFiles/cmTC_a9874.dir/testCCompiler.c.obj] Error 1
    mingw32-make.exe[1]: Leaving directory 'C:/Users/usuario/Desktop/CLionProjects/Bolet�n2/Ejercicio1/cmake-build-debug/CMakeFiles/CMakeTmp'
    mingw32-make.exe: *** [Makefile:140: cmTC_a9874/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 "C:/Users/usuario/Desktop/CLionProjects/Boletín2/Ejercicio1/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "C:/Users/usuario/Desktop/CLionProjects/Boletín2/Ejercicio1/cmake-build-debug/CMakeFiles/CMakeError.log".

[Failed to reload]

Thanks 4 the support or even reading this.


Solution

  • Try to rename your directory to Boletin1 and Boletin2
    REMOVE ALL ACCENTS and write it with the boring i letter, even if the spelling is then wrong in your language.
    This is an encoding problem and it occurs because in this case you have 3 programs (here cmake, gcc.exe and mingw64-make.exe) that parse the same character with different results (which are Bolet�n2, Bolet├¡n2 and Boletín2).
    You might also have to reset clion's cache and/or remove projects from the IDE and re-import them. It may have kept some path in cache and might try to feed them to cmake.