CMake:C和CXX编译器识别未知Win10 CMakeGUI

Ald*_*ldo 3 c++ windows cmake cmake-gui visual-studio-2015

所以我试图在youtube上基于本教程配置一个文件非常简单:

https://www.youtube.com/watch?v=gYmgbqGfv-8

我在Windows 10中使用CMake GUI,我有一个运行的Visual Studio 2015,它已经能够构建c ++项目(我已经使用了一段时间)

我使用"Visual Studio 15 2017"

我为两个输入创建了一个名为hellocmake和hellocmake/build的文件夹:

我的意见

但是,当我尝试配置时,它说

CMakeLists.txt的CMake错误:1(项目):

找不到CMAKE_C_COMPILER.

CMakeLists.txt的CMake错误:1(项目):

找不到CMAKE_CXX_COMPILER.

错误日志指定它找不到两个编译器文件:编译C编译器标识源文件"CMakeCCompilerId.c"失败.编译器:
构建标志:Id标志:

The output was:
The system cannot find the file specified


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:  
Build flags: 
Id flags: 

The output was:
The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)

我尝试下载"CMakeCXXCompilerId.cpp"和"CMakeCXXCompilerId.c"文件,并尝试在同一文件夹中手动添加它们,但它没有解决它

我试图查找其他几个有类似情况的来源,但我似乎无法理解它们.我的旧电脑不存在这个问题所以我认为它与Visual Studio有关?

谢谢你们,任何帮助将不胜感激

rub*_*nvb 13

您选择了尚未安装的Visual Studio 2017.我认为您对版本发布年份的实际版本号(VS2017为15)感到困惑.选择一个VS2015发电机(版本号14),它应该工作.

  • 非常感谢 !这有效!:D (2认同)

J.B*_*B.D 5

我同意@rubenvb的回答,添加一个提示:在执行将"15"更改为"14"之前,应删除"CMakeCache.txt"文件.

cmake -G 
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • 对不起,我没有50个声望,所以无法评论其他人的答案 (8认同)