Displaying the #include hierarchy for a C++ file in Visual Studio

There is a setting:

Project Settings -> Configuration Properties -> C/C++ -> Advanced -> Show Includes

that will generate the tree. It maps to the compiler switch /showIncludes


We have found IncludeManager to be a very powerful tool. It is not free (but not expensive) and it allowed us to get a grip of our Include issues and drop our compile time from 50 minutes to 8 minutes by pruning out large chunks of includes we weren't using.


The compiler also supports a /showIncludes switch -- it doesn't give you line numbers, but can give a pretty comprehensive view of which includes come from where.

It's under Project Settings -> Configuration Properties -> C/C++ -> Advanced -> Show Includes.