Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see the C/C++ #include graph easily? [closed]

I'm looking for a tool (preferably, a Visual Studio plugin) that would display all files included by a given file and show all files included by those files and so on.

like image 682
CannibalSmith Avatar asked Jun 18 '10 11:06

CannibalSmith


2 Answers

First, cinclude2dot.pl is a perl script which analyses C/C++ code and produces a #include dependency graph as a dot file for input into graphviz.

http://www.flourish.org/cinclude2dot/

If you don't want to go the way of that sort of manual tool, then the hands-down by far winner is in my opinion a tool known as "IncludeManager" from ProFactor.

http://www.profactor.co.uk/includemanager.php

There's a free trial, and it is awesome. It's a plug-in for Visual Studio that's totally integrated so double clicking on something over here takes you to the place where it is included over there.

Tooltip mouseovers give you all the info you would want, and it lets you drill down / up, remove whole subtrees you don't care about, view representations other than graphs, cycle through a list of matches for this and that, it's wonderful.

If you're quick about it, you can refactor the #include structure of a large projects before the trial runs out. Even so, it doesn't cost much, about $35 per license.

For what it does, it is just about perfect. Not only #include graphs but also cross project dependencies of shared files, impact on build times, detailed properties in grids, perfect.

like image 199
Allbite Avatar answered Oct 05 '22 21:10

Allbite


Doxygen, with the aid of Graphviz, can do that. You first need to edit a configuration file. This won't be easy the first time you do it, but no much editing is needed afterwards.

like image 22
kgiannakakis Avatar answered Oct 05 '22 21:10

kgiannakakis