Tool to track #include dependencies


Question

Any good suggestions? Input will be the name of a header file and output should be a list (preferably a tree) of all files including it directly or indirectly.

1
167
12/12/2013 6:33:27 AM

Accepted Answer

If you have access to GCC/G++, then the -M option will output the dependency list. It doesn't do any of the extra stuff that the other tools do, but since it is coming from the compiler, there is no chance that it will pick up files from the "wrong" place.

139
10/10/2010 10:02:38 PM

Thanks to KeithB. I looked up the docs for cl.exe (VS2008) and found the /showIncludes flag. From the IDE, this can be set from the property page of any CPP file.

Screen shot


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon