我正在尝试使用 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/