【问题标题】:How can I solve this compiling error on CLion?如何解决 CLion 上的这个编译错误?
【发布时间】:2020-12-10 08:16:21
【问题描述】:

我使用一个名为 CLionProjects 的主目录,在它上面我有几个目录。最近我添加了这些目录,以便组织我的文件。我第一次安装 CLion 时使用了一个名为“Boletin1”的目录,它位于主目录中,后来当我创建“Boletin2”(在这些目录中我有名为 Ejercicio1、Ejercicio2 等的项目)时,问题开始出现,我收到此错误消息: 我必须明确编译器问题仅在“Boletin2”目录中,而名为“Boletin1”的目录可以正常工作。

我输入调试:

"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]

感谢 4 的支持甚至阅读本文。

【问题讨论】:

  • 我对在 Windows 或 CLion 上编译不是很熟悉,但您的目录名称似乎存在一些问题。您说您将其称为“Boletin”,但错误消息显示为“Bolet├â¡n。那是可疑的。澄清一下:你的 CMakeLists 是自动生成的,对吧?
  • 您是否检查过其他具有类似错误消息的问题?例如。 that 1that 2that 3。您是否尝试过他们的解决方案?在不知道您尝试过什么的情况下,我们只能提供相同的答案...
  • Boletín2 看起来你的项目路径中有 Unicode 字符,mingw 可能无法处理

标签: c++ c cmake compiler-errors clion


【解决方案1】:

尝试将您的目录重命名为 Boletin1Boletin2
删除所有重音 并用无聊的 i 字母书写,即使您的语言中的拼写错误.
这是一个编码问题,因为在这种情况下,您有 3 个程序(此处为 cmakegcc.exemingw64-make.exe)解析相同的字符但结果不同(它们是 BoletÃ�n2Boletín2 和 @ 987654329@).
您可能还需要重置 clion 的缓存和/或从 IDE 中删除项目并重新导入它们。它可能在缓存中保留了一些路径,并可能尝试将它们提供给cmake

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-19
    • 2019-07-15
    • 1970-01-01
    • 2013-03-17
    • 1970-01-01
    • 2016-06-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多