I am working on a big C project. I am using Visual Studio to browse the source code. There are many C structs in the project and they are inter connected to each other. So I am wondering if there's a tool can generate a diagram of the struct relations. For example, which references whose field. This may give me a better overview of the whole project.
While there are some Visual Studio components that provide the sort of information that you are asking for they tend to be limited to specific versions of VS.
I would suggest using doxygen - it is a free tool that can generate various formats to document C, C++ and other code. A good option is to have it generate html documentation, with diagrams such as uses and used by diagrams. You can use DoxyWizard to configure and doxygen for a given project and save the configuration, (be sure to select the "document undocumented source" option but once this is done you can include the document build step into your project build process.
If you select .svg format for the diagrams in the web pages the blocks for functions or classes will be links to the generated documentation for that function and you can optionally have links to the code.
For the optimum diagram generation you also need to install Graphviz and tell doxygen where it is installed.
- Both tools are available free and are free to use in commercial environments as well as private/academic.
- Both are cross platform and will work on Windows, OS-X & Linux.
- DoxyGen will work with any code project in any of the following languages:
- C, C++, Objective-C, C#,
- PHP, Java, Python,
- DL (Corba, Microsoft, and UNO/OpenOffice flavors),
- Fortran, VHDL, Tcl,
- and to some extent D
Must you use VS?
If you can use Linux, even in a VM, then I highly recommend the DDD debugger.
This pitcure will show you why:
The graphics at the top (a linked list in this case) are generated directly from your data at run-time.
Whtat do you think? Is that worth swapping o/s for?
Alas, I have searched for years and cannot find a Windows port of the debugger :-(