How to create header include graph using Doxygen

Include graph of a header file generated by Doxygen
Include graph of a header file, generated using Doxygen

Header files of C and C++ are a major problem in understanding or extending code of large projects. One header file can be included by another which itself can be included by another header file and so on. In large projects, it quickly becomes difficult to see which header files include a given header file and how. Obtaining a directed graph of which header files include a given header file can help in understanding the situation better.

Such graphs can be generated easily using Doxygen. I prefer to use Doxywizard to generate the Doxygen file for a project. (This post explains how to use Doxywizard.) Make sure the following options are set in the Doxywizard dialog:

  1. In Wizard tab, under Output, select HTML output.

  2. In Wizard tab, under Diagrams, choose the option Use dot tool from the GraphViz package. Select the following two options below it: Include dependency graphs and Included by dependency graphs.

After this generate the documentation. In the HTML documentation, open index.html, go to the Files section and choose the header file of interest to you. You can see that Doxygen has generated two directed graphs: a graph of the other header files that this file includes in its code and the second graph below it that shows which other header files include this file.

Tried with: Doxygen 1.7.6.1 and Ubuntu 12.04

Advertisements

2 thoughts on “How to create header include graph using Doxygen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s