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

1.5k views Asked by At

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

There are 1 answers

0
Chuck Walbourn On

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.