Visual Studio cmake 不可见的编译器
Visual Studio compilers not visible by cmake
我正在尝试使用 mysql.h
在 C++ 中构建程序
所以我读到必须使用 cmake 进行编译。但是即使我通过 Developers 命令提示符打开它,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.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.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
。
我正在尝试使用 mysql.h
在 C++ 中构建程序所以我读到必须使用 cmake 进行编译。但是即使我通过 Developers 命令提示符打开它,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.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.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
。