【问题标题】:QtCreator on Windows: No CMAKE_CXX_COMPILER could be foundWindows 上的 QtCreator:找不到 CMAKE_CXX_COMPILER
【发布时间】:2020-12-02 16:25:43
【问题描述】:

我有 Visual Studio 2019、CMake 3.18.4、Ninja 1.10.1、Qt 5.15.0、QtCreator 4.13.2,我正在尝试使用 QtCreator 打开一个 Qt/CMake 项目。

我从 CMake 得到这个输出:

2020-12-02T17:04:23 Clang Code Model: Error: The clangbackend process has finished unexpectedly and was restarted.
Running C:\Dev\Libs\Qt-5.15\Tools\CMake_64\bin\cmake.exe -S C:/Dev/test1 -B C:/Users/me/AppData/Local/Temp/QtCreator-GpQBVK/qtc-cmake-tnApaSrE -GNinja "-DCMAKE_BUILD_TYPE:String=Debug" "-DQT_QMAKE_EXECUTABLE:STRING=C:/Dev/Libs/Qt-5.15/5.15.0/msvc2019_64/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:STRING=C:/Dev/Libs/Qt-5.15/5.15.0/msvc2019_64" "-DCMAKE_C_COMPILER:STRING=" "-DCMAKE_CXX_COMPILER:STRING=" in C:\Users\me\AppData\Local\Temp\QtCreator-GpQBVK\qtc-cmake-tnApaSrE.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "C:/Users/me/AppData/Local/Temp/QtCreator-GpQBVK/qtc-cmake-tnApaSrE/CMakeFiles/CMakeOutput.log".
See also "C:/Users/me/AppData/Local/Temp/QtCreator-GpQBVK/qtc-cmake-tnApaSrE/CMakeFiles/CMakeError.log".
CMake process exited with exit code 1.
Elapsed time: 00:01.

无论在 Kit 配置中选择哪个 CMake Tool(我都可以从 CMake 3.18.3 (Qt)System CMake at C:\程序文件\CMake\bin\cmake.exe)

套件配置显示警告标志,虽然不清楚是什么问题:

明显的问题似乎是参数"-DCMAKE_CXX_COMPILER:STRING=" 被传递给CMake(空字符串)。

但是套件中设置了C和C++编译器。

【问题讨论】:

    标签: visual-c++ cmake qt-creator


    【解决方案1】:

    通过Qt维护工具升级解决。

    【讨论】:

    • 澄清一下:我已经将 Qt 从 5.12.4 更新到 5.12.10,它似乎已经解决了这个问题。我怀疑它与 Qt 版本有关,而不是更新 Qt 修复了任何损坏的行为。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多