代码之家  ›  专栏  ›  技术社区  ›  Startec

CMAKE:“找不到CMAKE_CXX_编译器。”

  •  0
  • Startec  · 技术社区  · 7 年前

    我有一个简单的项目,文件结构如下:

    - CMakeLists.txt
    - main.cpp
    

    这个 CMakeLists.txt 看起来像这样:

    # Project initialization
    cmake_minimum_required (VERSION 2.6)
    project (Tutorial)
    add_executable(Tutorial main.cpp)
    

    当我运行Cmake GUI时,我得到:

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

    enter image description here

    我安装了Microsoft Visual Studio 2017。我已经编译并运行了它的应用程序。来自的基本示例 the CMAKE tutorial 不起作用。

    有人能告诉我为什么吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Bowie Owens    7 年前

    我不知道出了什么问题,但你可能想看看:

    https://docs.microsoft.com/en-us/cpp/ide/cmake-tools-for-visual-cpp?view=vs-2017

    Visual Studio 2017能够直接打开cmake文件(应该在后台为您执行生成器步骤),这可能会避免您遇到的问题。

    推荐文章