5

I know that header guards avoid (most) trouble; call me @n@l if you like, but I just don't like a sloppy header-file tree.

If I draw on paper a box for each header file and connect them by lines representing #include, I like to see a neat hierarchy. But what I usually see is a complex web.

Maybe I am @n@l, but to me that tangled web represents sloppy-thinking and I would like to induce order by reorganizing the #include hierarchy.

Does anyone know of a tool which will let me vizualize the #include hierarchy? Preferably a free tool.

(and, yes, I know that I "could probably do it with graphviz dot", but that is not an answer ;-)

Kara
  • 6,115
  • 16
  • 50
  • 57
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551

2 Answers2

4

Doxygen can do this for you if you use it along with the dot tool.

Here is an example: http://www.neuraladvance.com/json-c/html/json_8h.html

Cromulent
  • 3,788
  • 4
  • 31
  • 41
  • Doxygen can also print a neat hierarchy diagram representing all dependencies for C, C++, Python, Java, etc. – manav m-n Jan 31 '10 at 08:23
  • 1
    hmm, why didn't I think about Doxygen? Simon, can it do that for the whole project, or just on aper-file basis? I really want it for the whole project. You don't really see the complexity on a single file. – Mawg says reinstate Monica Feb 01 '10 at 02:30
  • @Mawg - I'm not sure to be honest. I've never had the need for a full dependency graph. I'm pretty sure that it would be easy to do although you might have to do a bit delving. After all Doxygen already has everything you need you might just have to do the stitching together manually. – Cromulent Feb 01 '10 at 10:34
  • Yep, DoxyGen does it! Thanks. – Mawg says reinstate Monica Feb 04 '10 at 10:55
  • @Mawg - please tell us how! You may want to put that in an answer to: http://stackoverflow.com/questions/6496644/using-doxygen-to-create-through-graphvizs-dot-a-graphical-representation-of-th – Gauthier Oct 12 '11 at 07:24
4

You could try cinclude2dot

Hasturkun
  • 35,395
  • 6
  • 71
  • 104