View Dependent Dependencies

Does anyone know a tool that will analyze the C ++ code base and display a graphical representation, which files include header files and redundant highlighting? I used Understand C ++, but it was expensive and very quickly became very cumbersome on a large (and poorly encapsulated) code base.

+3
source share
2 answers

There is always an "-H" option for gcc / g ++ ...

For example:% g ++ -H foo.C

'-H'
     Print the name of each header file used, in addition to other
     normal activities.  Each name is indented to show how deep in the
     '#include' stack it is.  Precompiled header files are also
     printed, even if they are found to be invalid; an invalid
     precompiled header file is printed with '...x' and a valid one
     with '...!' .

Then:

  • 'sed' or 'awk' to remove the leading "...".
  • 'so that neighboring addresses match.
  • 'uniq -c' for counting names.
  • 'grep -v' to remove singlets.

How in:

%  g++ -H  foo.C |& awk '{print $2}' | sort | uniq -c | grep -v '      1 '

Linuxux'/unix' ?

( cygwin.)

+3

#include

, . "" , . ifdefs . .

+1

All Articles