8

Does anyone know of a standalone software (or plugin for Visual Studio) that can generate UML class diagrams from C++ code?

0

3 Answers 3

4

Take a look at DoxyGen.

It is widely used in industry . If you add specially formatted comments to your code, it can generate some very useful documentation. in fact the first thing I do on every new contract is to run the code through Doxygen.

In fact, even without the comments, it still gives a great deal of information, such as call trees, class diagrams and the like.

Read about its diagrams here

And read the S.O question How to use doxygen to create UML class diagrams from C++ source

2

This is not exactly UML (but neither are the class diagrams in VS), but comparable and it provides so much more: SourceTrail.

The application is FLOSS and hosted over on GitHub.

1
  • I use Understand at work, and searched for a loooong time for a gratis alternative. I was overjoyed when I found SourceTrail. This gets my vote
    – Mawg
    Commented Jan 24, 2021 at 19:18
2

Visual Studio 2017 (Community Edition), and later versions, have a Class Designer component for generating class diagrams. Follow the setup instructions by Microsoft in this article for installing the Class Designer component.

Once installed, open your Visual Studio project, right-click on a header file and select the "View Class Diagram" option.

Caveat: The Class Designer feature only works with Visual Studio project files (i.e. *.vcxproj). You won't be able to use this feature if you have a CMake project. Check this post on Visual Studio's developer community for further info.

1
  • Deespite having the currently most upvoted comment, I believe this to be the simplest solution. Doxygen is excelleant, and I highly recommend using it (fully), but this answers OP's quiestion, cheap & cheerfuly. Good answer
    – Mawg
    Commented Nov 10, 2023 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.