views:

26

answers:

1

hey there!

is there a way in visual studio to select some type and display how it gets included into the current file?

for example i'd like to click on some membervariable

SomeType a;

and then get displayed something like "first_include.h"->"second_include.h"->"SomeType.h"

to understand what chain of includes the compiler uses to take the declaration of the variable SomeType.

Thanks!

A: 

Try the "show includes" option in C/C++->"Advanced Project Settings".

EDIT:

"Show includes" will display all the files that are includes from a particular file. Include files shown will be indented according to the level at which they are included. Use "go to definition" to find which file has the definition and then simply look for the hierarchy of includes which leads to that file.

Rajorshi
hmmm - and how can I use that to trace down where a certain declaration is comming from? all this apparently does is generating more compiler output
Mat
@Mat: Why do you specifically want all includes in the chain? Right-click -> Go to Definition will take you directly to the point where a symbol is defined.
casablanca
@Mat: Edited answer to elaborate. Agree with casblanca though. If you are not trying to resolve problems with name conflicts in multiple headers, there is no need to look at intermediate headers.
Rajorshi
because sometimes you get compilation errors in some headerfile that you probably don't even need and that way it's easier to find where you're actually including it
Mat