c++ - CMake 找不到 Visual C++ 编译器

标签 c++ cmake visual-studio-2015

在之前的项目上安装 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文件夹C:\Program Files\Microsoft Visual Studio 14.0中搜索cl.exe,找不到。

如何设置 CMake 以使用 Visual Studio 2015 在 Windows 上工作?

最佳答案

我找到了解决方案。虽然 Visual Studio IDE 安装成功,但它没有安装任何构建工具,因此没有安装 C++ 编译器。

通过尝试手动 create a C++ project in the Visual Studio 2015 GUI我能够提示它下载 C++ 包。然后 CMake 可以毫无困难地找到编译器。

关于c++ - CMake 找不到 Visual C++ 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31619296/

相关文章:

c++ - 在 Qt Creator 调试器中查看数组内容

c++ - 如何使用Rcpp使执行就地操作的C++函数可用于另一个R包?

c++ - 右值引用和x值有什么区别?

c++ - mingw-64 - 安装包

visual-studio-2015 - 无法使用 .vsix 文件为 Visual Studio Community 2015 安装扩展

c++ - 数组枚举和输入

c++ - 包含 Boost 库时 Android Studio 链接器命令失败

c++ - 如何将 Google 测试输出打印到文本文件?

c# - MSBuild 中出现错误 CS0840,但 VS2015 中没有错误

visual-studio - Visual Studio 2015 中的包管理器 "407 (Proxy Authentication Required)"