【问题标题】:C compiler broken: is not able to compile a simple test programC 编译器损坏:无法编译简单的测试程序
【发布时间】:2019-09-20 05:50:37
【问题描述】:

在我的 Dektop 和 Surface Pro 6 上,CLion 停止工作,我不知道具体原因。

这是写在我的桌面上的:

"C:\Program Files\JetBrains\CLion 2018.3.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\Alexander\Desktop\Clion\übung 
-- 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 2018.3.2/bin/cmake/win/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (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/Alexander/Desktop/Clion/übung/cmake-build-debug/CMakeFiles/CMakeTmp 

Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_254a1/fast" 
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_254a1.dir\build.make CMakeFiles/cmTC_254a1.dir/build 
mingw32-make.exe[1]: Entering directory 'C:/Users/Alexander/Desktop/Clion/³bung/cmake-build-debug/CMakeFiles/CMakeTmp' 
Building C object CMakeFiles/cmTC_254a1.dir/testCCompiler.c.obj 
C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_254a1.dir\testCCompiler.c.obj -c C:\Users\Alexander\Desktop\Clion\├�bung\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c 
gcc.exe: error: C:\Users\Alexander\Desktop\Clion\├�bung\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory 
gcc.exe: fatal error: no input files 
compilation terminated. 
CMakeFiles\cmTC_254a1.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_254a1.dir/testCCompiler.c.obj' failed 
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_254a1.dir/testCCompiler.c.obj] Error 1 
mingw32-make.exe[1]: Leaving directory 'C:/Users/Alexander/Desktop/Clion/³bung/cmake-build-debug/CMakeFiles/CMakeTmp' 
Makefile:120: recipe for target 'cmTC_254a1/fast' failed 
mingw32-make.exe: *** [cmTC_254a1/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/Alexander/Desktop/Clion/übung/cmake-build-debug/CMakeFiles/CMakeOutput.log". 
See also "C:/Users/Alexander/Desktop/Clion/übung/cmake-build-debug/CMakeFiles/CMakeError.log".

对于我的 Surface Pro 6:

"C:\Program Files\JetBrains\CLion 2018.3.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\Alexander\Desktop\CLion\udemy-übung-arrays 
-- The C compiler identification is GNU 7.1.0 
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe 
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe -- broken 
CMake Error at C:/Program Files/JetBrains/CLion 2018.3.2/bin/cmake/win/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message): 
The C compiler

"C:/Program Files/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/Alexander/Desktop/CLion/udemy-übung-arrays/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command:"C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/bin/mingw32-make.exe" "cmTC_d8abd/fast" 
C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_d8abd.dir\build.make CMakeFiles/cmTC_d8abd.dir/build 
mingw32-make.exe[1]: Entering directory 'C:/Users/Alexander/Desktop/CLion/udemy-³bung-arrays/cmake-build-debug/CMakeFiles/CMakeTmp' 
Building C object CMakeFiles/cmTC_d8abd.dir/testCCompiler.c.obj 
C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\gcc.exe -o CMakeFiles\cmTC_d8abd.dir\testCCompiler.c.obj -c C:\Users\Alexander\Desktop\CLion\udemy-├�bung-arrays\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c 
gcc.exe: error: C:\Users\Alexander\Desktop\CLion\udemy-├�bung-arrays\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory 
gcc.exe: fatal error: no input files 
compilation terminated. 
CMakeFiles\cmTC_d8abd.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_d8abd.dir/testCCompiler.c.obj' failed 
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_d8abd.dir/testCCompiler.c.obj] Error 1 
mingw32-make.exe[1]: Leaving directory 'C:/Users/Alexander/Desktop/CLion/udemy-³bung-arrays/cmake-build-debug/CMakeFiles/CMakeTmp' 
Makefile:120: recipe for target 'cmTC_d8abd/fast' failed 
mingw32-make.exe: *** [cmTC_d8abd/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/Alexander/Desktop/CLion/udemy-übung-arrays/cmake-build-debug/CMakeFiles/CMakeOutput.log". 
See also "C:/Users/Alexander/Desktop/CLion/udemy-übung-arrays/cmake-build-debug/CMakeFiles/CMakeError.log".

[重新加载失败]

【问题讨论】:

  • 欢迎来到 StackOverflow!您的问题需要一些工作,以便社区可以更好地帮助您。看看how to ask a good question,再试一次。
  • 问题显然出在文件名上。那里的 unicode 字母发生了一些有趣的事情。我猜您将文件夹命名为 Übung?尝试改为exercise

标签: c cmake mingw clion


【解决方案1】:

查看之前对标题的回答:如何在MinGW或MinGW-w64中使用CMAKE编译Clion:

CLion: Error:The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program

答案是:你不应该在你的PATH 环境变量中加入sh.exe,它是known to cause problem.

或者使用 ninja 作为 make 的替代品。

【讨论】:

    【解决方案2】:

    避免路径中的特殊字符和空格,在您的情况下übung 不是一个好主意。

    Windows 上的 GCC 无法正确处理这些路径。

    我还看到您使用的是 GCC 6 和 7,它们已经过时了。您可以从https://winlibs.com/ 获得更新版本的 Windows 版 MinGW-w64 GCC

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-23
      • 1970-01-01
      • 1970-01-01
      • 2019-05-07
      • 2020-11-13
      • 2017-05-21
      相关资源
      最近更新 更多