The gidd tool will look at c/c++ include file dependencies and generate Graphviz .dot files and PlantUML diagrams to visualize the dependency. It uses the output from gcc/g++'s -H flag to understand the dependencies.
To enable, add -H to gcc/g++. When using cmake, add this to your CMakeLists.txt:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -H")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H")
All includes in a cmake project:
mkdir build && cd build
cmake .. && make clean && make -j1 &> input.txt
it is also possible to generate includes for one file in a project:
touch ../src/file.cpp
make -j1 &> input.txt
dot -Tsvg output.dot > doc/examples/output_dot.svg
dot -Tsvg output_no_clusters.dot > doc/examples/output_no_clusters_dot.svg
dot -Tpng output.dot > doc/examples/output_dot.png
dot -Tpng output_no_clusters.dot > doc/examples/output_no_clusters_dot.png
plantuml -tsvg output.puml -o doc/examples
plantuml -tsvg output_no_clusters.puml -o doc/examples
plantuml -tpng output.puml -o doc/examples
plantuml -tpng output_no_clusters.puml -o doc/examples
If you are not interested in a set of include folders (normally the system or default), you can add a filter.txt in the same folder as input.txt where you can filter out certain folders. The easiest way of getting a list of include folders is to run gidd once and gidd will print all used folders. Then you can copy/paste from that list into the filter.txt file and run gidd again.
Here is an example of how a tiny hello world example can look like:
#include <cstdio>
int main() {
printf("Hello, World!\n");
}
output_no_clusters.dot: output.dot: output_no_clusters.puml: output.puml: