CLion - 创建新项目时出现CMake错误

时间:2017-03-08 21:37:19

标签: c++ cmake clion

我刚刚使用MinGW在我的计算机上安装了CLion并决定创建一个简单的Hello World项目来测试它,但是当我创建它时,控制台会输出错误:

>"C:\Program Files (x86)\JetBrains\CLion 2016.3.3\bin\cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" "E:\Programação\C++\Hello World"

>-- The C compiler identification is GNU 5.3.0

>-- The CXX compiler identification is GNU 5.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 (x86)/JetBrains/CLion 2016.3.3/bin/cmake/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (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: Hello World/cmake-build-debug/CMakeFiles/CMakeTmp



>  Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_11be0/fast"

>  C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_11be0.dir\build.make
  CMakeFiles/cmTC_11be0.dir/build

>  mingw32-make.exe[1]: Entering directory 'Hello
  World/cmake-build-debug/CMakeFiles/CMakeTmp'

>  Building C object CMakeFiles/cmTC_11be0.dir/testCCompiler.c.obj

>  C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_11be0.dir\testCCompiler.c.obj -c
  "Hello
  World\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c"

>  gcc.exe: error: Hello
  World\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file
  or directory

>  gcc.exe: fatal error: no input files

>  compilation terminated.

>  CMakeFiles\cmTC_11be0.dir\build.make:64: recipe for target
  'CMakeFiles/cmTC_11be0.dir/testCCompiler.c.obj' failed

>  mingw32-make.exe[1]: *** [CMakeFiles/cmTC_11be0.dir/testCCompiler.c.obj]
  Error 1

>  mingw32-make.exe[1]: Leaving directory 'Hello
  World/cmake-build-debug/CMakeFiles/CMakeTmp'

>  Makefile:125: recipe for target 'cmTC_11be0/fast' failed

>  mingw32-make.exe: *** [cmTC_11be0/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 "Hello World/cmake-build-debug/CMakeFiles/CMakeOutput.log".
>See also "Hello World/cmake-build-debug/CMakeFiles/CMakeError.log".

据我所知,它无法在项目目录中创建一些文件。有谁知道为什么?

我还应该指出,我遇到了问题,因为我的防病毒软件检测到appdata中的cmake临时文件是病毒,还有“Hello World \ cmake-build-debug \ CMakeFiles \ 3.6.3 \ CompilerIdC \ a”。 exe“可执行文件。

编辑: 看起来我终于修复了它。根据我的理解gcc.exe没有识别项目目录,因为它有空格和其他符号,如“ç”和“ã”。所以更改一些文件夹名称解决了问题。

1 个答案:

答案 0 :(得分:1)

Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken

// Rest of log

gcc.exe: fatal error: no input files

这两行表示在您的计算机上安装CLion存在一些问题。我从经验中知道这一点,因为我第一次使用您观看的同一视频安装了CLion时出现了这个错误。

我建议您观看此视频:

  

Install & Configure CLion Student Copy|| best IDE for C/C++ - Youtube视频

我建议这个视频的原因是因为它是可用于在Windows 10计算机上安装CLion的最新版本。你应该做的是浏览整个视频,看看MinGW软件包是如何安装的,安装了哪些软件包,以及如何安装和设置CLion。如果您执行了与此视频不同的任何操作,则可能是您需要解决的错误。另外,我还使用了这个视频,它对我有用。

如果您按照视频中的所有内容,那么您应该只需卸载MinGW和Clion并再次尝试;这是我怎么做的。但这只是作为最后的手段。首先要确保你没有错过教程中的任何内容,特别是MinGW软件包的安装方式。

顺便说一句,这个问题也有类似的问题,并且发布的答案有效,所以你可能也想看看:

  

can't run any program in clion - StackOverflow帖子

相关问题