【发布时间】:2017-07-29 16:08:15
【问题描述】:
我刚刚使用 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 无法识别项目目录,因为它有空格和其他符号,如“ç”和“ã”。所以更改一些文件夹名称解决了这个问题。
【问题讨论】:
-
I was running into problems because my antivirus was detecting cmake temp files in appdata as viruses- 所以,你知道为什么它不适合你了。你想从我们这里得到什么? -
@Tsyvarev 我已经在防病毒软件上添加了例外,它似乎不再困扰我了。只是为了确保我删除并重新创建了该项目,但它仍然会发生。
-
为什么您确定防病毒软件的问题已经消失?您仍然会丢失应该存在的文件(例如
CMakeFiles\CMakeTmp\testCCompiler.c)。 -
MinGW 发行版中是否安装了 GCC 和 G++?
-
@Tsyvarev 它没有给我任何警告,但我考虑到了你所说的并告诉防病毒软件将文件夹与我拥有的其他语言的所有其他项目一起导入,它仍然不会即使在重新创建项目之后也无法正常工作。