CXX compiler identification is different version

I had VS2022, but project was incompatible with it, so I uninstalled it and got VS2019. I assume cmake kept info of the old compilers and now fails to work

-- The CXX compiler identification is MSVC 19.29.30154.0 
-- The C compiler identification is MSVC 19.29.30154.0                                                                                          
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - broken  
CMake Error at D:/anaconda3/Library/share/cmake-3.24/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"  is not able to compile a simple test program.

What do I do?

If you change your toolchain, you should also clear your build directory and start afresh again. If you don’t want to delete your whole build directory, it should be enough to just add the --fresh option to your cmake command line, and that will discard previously computed values, including toolchain details.

1 Like