CMake 3.13.2似乎在G ++ 8.2.0中有问题

时间:2019-01-06 10:59:09

标签: c++ gcc cmake g++

我正在使用MinGW将我的G ++编译器升级到8.2.0版。 现在Cmake不再工作了。

使用64位Win10。

它告诉我“ gcc.exe无法编译简单的测试程序”。两种编译器都可以在控制台上使用gcc和g ++。

我已经尝试过多次重新安装编译器,而没有任何结果。

C:\temp>g++ --version
        g++ (MinGW.org GCC-8.2.0-1) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C:\temp>cmake --version
        cmake version 3.13.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

C:\temp>g++ hello.cpp

        C:\temp>a.exe
        Hello, World!

C:\temp>gcc hello.c

        C:\temp>a.exe
        Hello World

        C:\temp>cmake . -G "MinGW Makefiles"
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.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/CMake/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:/temp/CMakeFiles/CMakeTmp

        Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_7fbea/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_7fbea.dir\build.make CMakeFiles/cmTC_7fbea.dir/build
        mingw32-make.exe[1]: Entering directory 'C:/temp/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_7fbea.dir/testCCompiler.c.obj
        C:\MinGW\bin\gcc.exe    -o CMakeFiles\cmTC_7fbea.dir\testCCompiler.c.obj   -c C:\temp\CMakeFiles\CMakeTmp\testCCompiler.c
        Linking C executable cmTC_7fbea.exe
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_7fbea.dir\link.txt --verbose=1
"C:\Program Files\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_7fbea.dir/objects.a
        C:\MinGW\bin\ar.exe cr CMakeFiles\cmTC_7fbea.dir/objects.a @CMakeFiles\cmTC_7fbea.dir\objects1.rsp
        C:\MinGW\bin\ar.exe: could not create temporary file whilst writing archive: no more archived files
CMakeFiles\cmTC_7fbea.dir\build.make:87: recipe for target 'cmTC_7fbea.exe' failed
        mingw32-make.exe[1]: *** [cmTC_7fbea.exe] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/temp/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_7fbea/fast' failed
        mingw32-make.exe: *** [cmTC_7fbea/fast] Error 2




CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)


-- Configuring incomplete, errors occurred!
See also "C:/temp/CMakeFiles/CMakeOutput.log".
See also "C:/temp/CMakeFiles/CMakeError.log".

非常感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

切换到mingw-64解决了我的问题!