安装 Visual Studio 2015 并在以前的项目上运行 CMake 后,CMake 错误指出它找不到 C 编译器。
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:4 (PROJECT):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:4 (PROJECT):
No CMAKE_CXX_COMPILER could be found.
我在 Visual Studio 文件夹中搜索 cl.exe
C:\Program Files\Microsoft Visual Studio 14.0
,但找不到。
如何设置 CMake 以使用 Visual Studio 2015 在 Windows 上工作?
原文由 Asher 发布,翻译遵循 CC BY-SA 4.0 许可协议
我找到了解决方案。虽然 Visual Studio IDE 安装成功,但它没有安装任何构建工具,因此没有安装 C++ 编译器。
通过尝试 在 Visual Studio 2015 GUI 中手动创建 C++ 项目, 我能够提示它下载 C++ 包。然后 CMake 能够毫无困难地找到编译器。