c++ - cmake 不可见 Visual Studio 编译器

标签 c++ mysql visual-studio visual-studio-2015 cmake-gui

我正在尝试使用 mysql.h 在 C++ 中构建一个程序

所以我读到用 cmake 编译是必要的。但似乎 cmake 无法找到 Visual 的工作室编译器,即使我通过开发人员命令提示符打开它。
这是发生的错误:

The C compiler identification is unknown

The CXX compiler identification is unknown

CMake Error in CMakeLists.txt: No CMAKE_C_COMPILER could be found.

CMake Error in CMakeLists.txt: No CMAKE_CXX_COMPILER could be found.

Also, at cmake error list, it says :

Build started 22/12/2016 00:28:42.

The target "_ConvertPdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,37)" does not exist in the project, and will be ignored.

The target "_CollectPdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,70)" does not exist in the project, and will be ignored.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform‌​.targets(57,5): error MSB8020: The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

最佳答案

来自评论。该问题是由于 Visual Studio 2015 使用了错误的生成器引起的。

Visual Studio 2015 中 32 位代码的正确生成器是 Visual Studio 14 2015对于 64 位代码,它是 Visual Studio 14 2015 Win64 .

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

相关文章:

c++ - CGAL 一般多边形 : rigid motions and area

c++ - 无法使用 XLNT 库构建 C++ 项目

mysql - 如何快速对 MySQL 中的记录进行排序?

c# - 在c#中反编译.application程序//撤销之前在visual studio中保存的代码

visual-studio - 将 PowerShell Core 添加到 Visual Studio 的终端列表

c++ - 危险的做法?

c++ - Windows x64 上 32 位和 64 位应用程序之间的进程间通信

mysql - 哪种 AWS 产品适用于 Spring MVC 移动应用程序后端?

mysql - 等待表级锁 - mysql

visual-studio - 创建 Visual Studio 主题特定的语法高亮