Do you know tool building tree of include files in project\file?

I know this is an old question, a slightly more useful output than the gcc/g++ -E output alone would also used the -H flag (instead or in addition to):

g++ -H {my -I and other flags} -E -o /dev/null file.cpp

here is a sample output, tree structure helps figure out who included what
as a bonus it also lists at the bottom which files may benefit from an include guard

. generated/gen-cpp/File.h
.. /usr/include/thrift/TProcessor.h
... /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/string
.... /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/x86_64-redhat-linux/bits/c++config.h
..... /usr/include/bits/wordsize.h
..... /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/x86_64-redhat-linux/bits/os_defines.h
...... /usr/include/features.h
....... /usr/include/sys/cdefs.h
........ /usr/include/bits/wordsize.h
....... /usr/include/gnu/stubs.h
........ /usr/include/bits/wordsize.h
........ /usr/include/gnu/stubs-64.h
..... /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/x86_64-redhat-linux/bits/cpu_defines.h
.... /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/stringfwd.h

...

Leave a Comment