While working on my raytracer, I became curious as to what the dependency graph of my code looked like. To accomplish this, I wrote a Python script that will scan a given directory and generate the dependency graph as a PDF file. This graph can either help you find unnecessary dependencies, locate circular dependencies, or just satisfy your curiosity.
This script requires both Python 2.6 and dot. If you are running Ubuntu, you can install dot with:
sudo apt-get install graphviz
Running the script with python is done as follows:
python cppdepends.py dir outfile
Where dir contains the source tree you wish to generate a graph for, and outfile is the pdf file you wish to output to.
This program is located at http://github.com/nflath.cppdepends. If you have any suggestions or improvements, or even if you just used it, please let me know.