I’m working on a project in Visual Studio 2010. My project is not supposed to be limited to Windows, however, one of the files is OS-dependant.
For this reason, I have #include <windows.h> in only one of the .cpp files. No other file includes this .cpp files. Therefore, logically, the windows.h header should be invisible to the rest of the solution.
This means that I don’t have any name conflicts with declarations in the Windows library in all files but that one .cpp, and my project compiles just fine.
However, IntelliSense keeps on insisting that I have name conflicts. When I press Ctrl+Space, IntelliSense suggests identifiers from windows.h. And this is in the scope where windows.h should be invisible!
Is there a setting I can change to stop this annoying behaviour?
I’m 100% positive that the issue is not with the structure of my solution because if I use an identifier already defined in windows.h in another part of my project, the compiler does not recognize it and it doesn’t compile…but IntelliSense recognizes it!
Quoting Andy Rich, a Microsoft employee who works on VC++, from a comment on this blog article: Troubleshooting Tips for IntelliSense Slowness
So unfortunately the answer is no, there’s nothing you can do beyond disabling IntelliSense altogether.