I would like to generate graphs where the dependencies between directories (defined by #include)* are drawn and sub-directories are recursively nested within directory nodes.

  • Nesting should be possible with at least 2 layers.
  • Operating system Windows (preferred), Linux should it be necessary.
  • cost less than 100USD (one-time)
  • output format preferably DOT, SVG, PNG

It is required that the actual directories are drawn, not only the dependencies between files.

*: The dependencies are actually between the files and evaluated by the C-preprocessor.

What I found so far


Doxygen has been recommended and does quite a good job with its directory graphs. But it does not draw sub-directories of more than 1 level relatively to the documented directory. This behavior seems to be intentional - not a bug.


cinclude2dot has been recommended but this tool does not draw the actual directories.


The author of this blog article has, with "a little hacking", fed the output of gcc -H to CodeSonar. I can not afford CodeSonar for this feature. But his results are impressive: example

2 Answers 2


It's been a while since I used DOXYGEN (probably 15 years+ :)), but have you tried DOXYGEN with EXAMPLE_RECURSIVE tag? I am with the impression it did quite an excellent job in these days (talk 2000-2002).

EXAMPLE_RECURSIVE If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be searched for input files to be used with the \include or \dontinclude commands irrespective of the value of the RECURSIVE tag.

Another possible option, which is worth investigating, is if you can write a simple Python or C script, which would be able to do the job and generate GraphViz script, which then can give you the needed graph? I understand this is additional work, which would make my suggestion in vain, and probably way out of your initial question.

  • 1
    EXAMPLE_RECURSIVE does configure where example code fragments are searched for (see also EXAMPLE_PATH) analogous to RECURSIVE for the normal input files. So this option is of no help for the question. Generating directory graphs with its dependencies is not trivial. Instead of programming from scratch, extending Doxygen may be an option. Apr 7, 2020 at 10:42

Since the original question the requested feature has been added to Doxygen. See configuration DIR_GRAPH_MAX_DEPTH.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.