CMake error "No CMAKE_CXX_COMPILER could be found" while building visual studio 2010 project on visual studio 2017

huangapple go评论61阅读模式
英文:

CMake error "No CMAKE_CXX_COMPILER could be found" while building visual studio 2010 project on visual studio 2017

问题

Earlier I had Visual Studio 2017 Version 15.9.43.

In my project I have one sub project which is based on Visual Studio 2010, and we cannot upgrade it to Visual Studio 2017. To create a .sln file for this sub project, we used the command cmake.exe -G "Visual Studio 10 Win64" ...

Recently, I uninstalled Visual Studio 2017 Version 15.9.43 and installed the latest Visual Studio 2017 Version 15.9.54.

But now the same command cmake.exe -G "Visual Studio 10 Win64" .. is giving this error:

-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (PROJECT):
No CMAKE_CXX_COMPILER could be found.

-- Configuring incomplete, errors occurred!

PROJECT(MsgHandler CXX C) is throwing the error and not able to create its solution file.

I have Windows 7.1 SDK and VC++ 2010 Redistributable installed.

How to resolve this issue?

英文:

Earlier I had Visual Studio 2017 Version 15.9.43.

In my project I have one sub project which is based on visual studio 2010 and we cannot upgrade it to visual studio 2017. To create .sln file for this sub project we used command "cmake.exe -G "Visual Studio 10 Win64" ..

Recently uninstalled the Visual Studio 2017 Version 15.9.43 and installed latest visual studio 2017 Version 15.9.54.

But now the same command "cmake.exe -G "Visual Studio 10 Win64" .. is giving this error

-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (PROJECT):
  No CMAKE_CXX_COMPILER could be found.

-- Configuring incomplete, errors occurred!

PROJECT(MsgHandler CXX C) is throwing the error and not able to create its solution file.

I have windows 7.1 sdk and vc++ 2010 redistributable installed.

How to resolve this issue?

答案1

得分: 2

请参阅CMake文档

> 已移除。此前生成了Visual Studio 10 2010项目文件,但自CMake 3.25起已移除此生成器。仍可以使用将CMAKE_GENERATOR_TOOLSET设置为v100的Visual Studio 12 2013(或更高版本)生成器,或者使用NMake Makefiles生成器来构建VS 10 2010工具。

您应该真正查看为什么您无法升级该代码并进行修复。

请注意,VS 2010和VS 2017之间没有C++二进制兼容性。根据Microsoft文档,这仅适用于VS 2015更新3 - VS 2022。当然,使用严格的C ABI可以使其正常工作。

英文:

See the CMake docs

> Removed. This once generated Visual Studio 10 2010 project files, but the generator has been removed since CMake 3.25. It is still possible to build with VS 10 2010 tools using the Visual Studio 12 2013 (or above) generator with CMAKE_GENERATOR_TOOLSET set to v100, or by using the NMake Makefiles generator.

You should really look into why you can't upgrade that code and fix it.

Note that is NO binary compatibility for C++ between VS 2010 and VS 2017. Per the Microsoft Docs, this only holds for VS 2015 Update 3 - VS 2022. Of course with a strictly C ABI you can make it work.

huangapple
  • 本文由 发表于 2023年4月19日 19:12:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76053823.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定