c++ – Visual Studio Intellisense incorrect macro expansion with CMake


I am cross-compiling a legacy C++ project using CMake and Visual Studio 2022. The code compiles (mostly), but I am struggling to get Intellisense to work correctly when compiling not for Windows. I followed this page and I am setting the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER in the toolchain file. When I do that (and regenerate the cache), it appears that it it working:

Intellisense Expansion shows 4.9.2

However, the actual compiler version is not what Intellisense shows, as you can see in the build:

Compiler says its version is 4.6.3

Is there any way to figure out where VS is pulling this information from? Does anyone know why it is not getting it correctly? I am having other issues with Intellisense not finding system includes (but again, the compiler does), and I imagine that these are related.

Leave a Reply

Your email address will not be published. Required fields are marked *