M
M
Mikhail Matrosov2014-06-04 23:11:07
infographics
Mikhail Matrosov, 2014-06-04 23:11:07

How to visualize static dependencies in C++ code?

There is a big C++ project under Visual Studio. I would like to visualize the dependencies between its entities in order to better understand the structure of the project. The first thing that comes to mind is the class dependency graph. How to build it?
Consider the following code example:

class Used {
public:
  void bar();
};

class Base { };

class Derived : public Base {
public:
  void foo(Used*);  // Dependency on class Used
};

I would like to get something like this:
1W11K.png
Tried the following.
1. CppDepend. Able to do exactly what is needed, but for some reason it is buggy on large projects : it does not see some dependencies. There will be no errors during the analysis, so it is difficult to understand what exactly confuses him on such a large project. Plus, all dependencies are shown with the same type of arrows. I wrote to the developers, they have been promising to roll out the 5th version for a long time, but they still can’t, they only fixed a few small bugs in the 4th version. Picture for example:
27b86b052b3647f59f83a7f489149afa.png
2. doxygen. Knows how to build a collaboration graph for classes. Shows dependencies, but here's the problem: only inheritance and aggregation count as dependencies. I asked a question about this on stackoverflow , without success. The picture at the beginning, "what you want", is obtained just with the help of doxygen, if foo is declared as a field of the Used type, and not as a method with the Used argument. The real picture for the example looks like this:
7ieSf.png
3. Visual Studio 2013 Ultimate. The Architecture -> Generate dependency graph -> For solution option builds what is needed. But it does n't work at all for dependencies between different projects ! Kapets. And the arrows are also all of the same type:
f1e9d116f8aa4e4fa00cf0e58fc0210b.png
Interested in suggestions on how to build such a dependency graph between classes, as well as other ways to visualize static dependencies in C ++ code.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
ManWithBear, 2014-06-04
@mmatrosov

Enterprise Architect
Able to build graphs from code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question