1

I have some C++ code that do not compile, I would like to draw class diagrams from it. Is there something very basic (nothing fancy just bare bone) I can use ? I am on linux

statquant
  • 13,672
  • 21
  • 91
  • 162
  • 1
    A bit heavy. Generates docs too. http://www.stack.nl/~dimitri/doxygen/ – stardust Apr 21 '13 at 17:55
  • I think visual studio has a built-in tool to do that – tianz Apr 21 '13 at 17:56
  • 1
    "I have some C++ code that do not compile, I would like to draw class diagrams from it." - if it doesn't compile then something's messed up with the syntax -> no AST -> no class diagram. Feel the contradiction? –  Apr 21 '13 at 17:56
  • @H2CO3 There's a lot of truth to that *but* I'd imagine that a diagram generator isn't going to have anything close to the type and scope checking of a full-blown compiler so it probably isn't going to care about whole classes of semantic errors. – Elliott Apr 21 '13 at 18:14
  • @Elliott You didn't get my point. If source code doesn't compile, it very likely has syntax errors. –  Apr 21 '13 at 18:15
  • @H2CO3 Don't worry, I got it, I just don't agree that failing to compile the code is necessarily a good indicator of failing to generate a diagram based on it. – Elliott Apr 21 '13 at 18:21

3 Answers3

3

Depending on how damaged the code is you might want to take a look at the Umbrello UML Modeler. It handles converting C++ to UML diagrams as well as code generation and updating. It's also been known to handle source code that does not entirely build with a normal compiler..

Captain Obvlious
  • 19,754
  • 5
  • 44
  • 74
1

ArgoUML (http://argouml.tigris.org/) is a pretty good multi-platform UML diagram tool.

Alternatively, if you don't care about actually following strict UML conventions, there's several general online diagramming services like LucidChart (https://www.lucidchart.com/) that will let you create class diagrams that are kind of UML compatible but not really (and won't force you to try to stay compatible either).

EDIT: I just realised you meant tools to actually create the diagrams from the code, in which case I can only really think of Doxygen which will generate the diagrams as a side-effect of generating documentation for your code. Bit of Googling didn't really give me much else except perhaps this: http://www.codedrawer.com/ but I haven't checked it out personally.

You might also find some additional stuff here (thanks Colonel panic for the link): Generating UML from C++ code?

Community
  • 1
  • 1
Elliott
  • 1,127
  • 1
  • 9
  • 16
  • Actually, wait, I just realised that you meant *from* the code. – Elliott Apr 21 '13 at 17:56
  • the code does not compile, is it an issue ? – statquant Apr 21 '13 at 18:02
  • What H2CO3 said was right and will apply to any automatic tool. If your code will not compile due to syntactic errors then it is highly unlikely that any of these automatic tools (which also rely on syntax analysis in the same way as a compiler) will work either. – Elliott Apr 21 '13 at 18:05
  • These tools *might* be more lenient than a compiler in terms of semantic errors though -- for example, your UML diagram generator may well not care that you've tried to add 200 to the colour blue because it doesn't have any reason to. – Elliott Apr 21 '13 at 18:06
  • understood, pardon my ignorance, thanks for answering. – statquant Apr 21 '13 at 18:08
  • 1
    [some other links](http://stackoverflow.com/questions/405953/generating-uml-from-c-code) – Colonel Panic Apr 21 '13 at 18:09
  • No problem! Good luck with it :) – Elliott Apr 21 '13 at 18:11
1

BOUML is not the prettiest UML modeling program out there, but it is quite powerful and can draw diagrams from source code, and generate code from diagrams.

Edit: oh, it seems you need to pay for it now, it was free back in the days... You can probably still find an old free version somewhere on the Internet.

Thibaut
  • 2,400
  • 1
  • 16
  • 28
  • sourceforge.net/projects/douml you do not need to pay for "Bouml" :) My fork is open-source and ahead in terms of interface – Zeks May 12 '13 at 17:50