解决QtCreator中无法使用cmake

发布时间:2024年01月07日

报错如下:

Running E:\cmake\bin\cmake.exe E:/workspace/untitled "-GCodeBlocks - NMake Makefiles JOM" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DCMAKE_CXX_COMPILER:STRING=E:/VS/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe" "-DCMAKE_C_COMPILER:STRING=E:/VS/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe" "-DCMAKE_PREFIX_PATH:STRING=E:/Qt/Qt5.14.2/5.14.2/msvc2017_64" "-DQT_QMAKE_EXECUTABLE:STRING=E:/Qt/Qt5.14.2/5.14.2/msvc2017_64/bin/qmake.exe" in C:\Users\59526\AppData\Local\Temp\QtCreator-XDPFHB\qtc-cmake-DxxFFhya.
CMake Deprecation Warning:
  Support for "Extra Generators" like

    CodeBlocks

  is deprecated and will be removed from a future version of CMake.  IDEs may
  use the cmake-file-api(7) to view CMake-generated project build trees.


-- The CXX compiler identification is MSVC 19.29.30153.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: E:/VS/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe
-- Check for working CXX compiler: E:/VS/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe - broken
CMake Error at E:/cmake/share/cmake-3.27/Modules/CMakeTestCXXCompiler.cmake:60 (message):
  The C++ compiler

    "E:/VS/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'C:/Users/59526/AppData/Local/Temp/QtCreator-XDPFHB/qtc-cmake-DxxFFhya/CMakeFiles/CMakeScratch/TryCompile-uo8vmi'
    
    Run Build Command(s): E:/cmake/bin/cmake.exe -E env VERBOSE=1 jom -f Makefile /nologo cmTC_1314d\fast
    缁崵绮洪幍鍙ョ瑝閸掔増瀵氱€规氨娈戦弬鍥︽閵
    

  

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


-- Configuring incomplete, errors occurred!
CMake process exited with exit code 1.

在这里插入图片描述

再编译就好了

Running E:\cmake\bin\cmake.exe E:/workspace/untitled -GNinja in E:\workspace\build-untitled-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug.
-- The CXX compiler identification is MSVC 19.29.30153.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: E:/VS/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.7s)
-- Generating done (0.0s)
-- Build files have been written to: E:/workspace/build-untitled-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug
文章来源:https://blog.csdn.net/qq_40709711/article/details/135434770
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。