admin管理员组

文章数量:1389903

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 __VERSION__ defined as 4.9.2 >

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

< Compiler message shows __VERSION__ defined as 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.

本文标签: cVisual Studio Intellisense incorrect macro expansion with CMakeStack Overflow