Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to create header include graph using Doxygen

📅 2013-Dec-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ doxygen, doxywizard, header ⬩ 📚 Archive

Include graph of a header file generated by 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 and Ubuntu 12.04

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧