Creating a C++ Class Diagram - c++

In Visual Studio .NET projects you can add a "Class Diagram" to the project which renders a visual representation of all namespaces, classes, methods, and properties. Is there any way to do this for Win32 (not .NET) C++ projects? Either through Visual Studio itself or with a 3rd party tool?

If you have a Visual Studio 2008 solution composed of multiple C++ projects, you can only generate one class diagram per project.
For example, if you have one application project linking to 10 library projects, you'll have to generate 11 separate class diagrams.
There are two ways to work around this, neither of which is pleasant:
Cram all the source into a single project.
Create a class diagram for one project (the application, perhaps) and then drag files from all the other projects into the class diagram.
A more thorough exploration of the capabilities of the Visual Studio class designer is given in Visual C++ Class Designer.
Given the poor support for C++ class diagrams in Visual Studio, you're probably better off going with a commercial tool if you want anything more than a simple list of what classes you have. WinTranslator from Excel Software might be worth looking at, and someone I work with uses Source Insight.

Most UML tools should be able to do that. I know that Sparx Systems Enterprise Architect does.

I've got VS2008 SP1 Professional and class diagrams are working fine for C++ WIN32 and Makefile projects.

If you're using Visual Studio, class diagrams for C++ were not correctly implemented until Visual Studio 2008.

Class designer is not meant for C++, even in VS 2008. You will be better off with some more specialized tool. It works for simple projects which don't heavily use templates. Also, get modeling power toys from codeplex.
Try doing partial specializations and watch how it crams everything into a single shape.

A cheap way would be to document your source with Doxygen and let this tool create the class diagrams for you.

If your project is a c++ based project then you have to drawn class diagram of c++ first,If your project contain 'n' number of sub-projects then you have to drawn 'n+1' number of class diagram.
Basically a class diagram contains
class variables.
class functions.
Relation between classes.
You should place all the properties which are required for a class inside a class diagram. It looks like a table (graphical structure) having 3 rows type box.
Row 1. class name(If it is an Object diagram it should and must under lined).
Row 2. Variable list(One variable in one line).
Row 3. Function list(One function in one line)
You have to make the Relation between one class to another class.

Related

creating UML or class diagram manually from existing project

Is there anyway to build manually a class or UML diagram from some part of existing code in Visual Studio Professional? Assume there are plenty of project and classes. Can i manually select some of the classes (with only some of its base/derived classes and member functions) I am interested in, and they are automatically transferred to boxes with arrows and so on...?
The trivial and slow solution is to draw some boxes and corresponding arrows and then write the name of classes or member functions into boxes (With some drawing programs like Dia). However, can it be done maybe using a more efficient way with any plugin or extension?
Because, my final aim is to make my own documentation (visually) from the code i am working at. The code is big and I want to develope my own documentation only on some selective parts during the next years...
You can install the Class Designer component.
In addition, UML Designers have been removed.

Visual Studios 2015 C++ UML diagramm creating associations

I wrote an c++ application using Visual Studios 2015 for a class project in my school. Therefor, I have to submit an UML-Classdiagramm. I already heard of VS's ability of auto-generating UML diagramms from my written classes.
So I right-clicked on my solution explorer and generated this UML. I removed some unnecessary classes and already displayed some Members as association.
Now I want to associate some classes with each other because VS didn't do this for me. Those are one-to-many-associations like one bag associates with many items in it.
In code, I did this with a vector. but when I right-click the property and select "Show as Association" (or something similar :D) it keeps adding the vector-class instead of drawing my association to the class-type stored in this vector.
I also tried to add the associations manually but I can't because all the UML-classdiagramm-Items in my Toolbox are gray and not usable.
Any help is appreciated :)
I had the same problem. Visual Studio doesn't support this for C++. You have to create a new Diagram Project (not just adding it to your current project) and design your classes manually. The auto-generated class diagram works for C# (only?).

How to create 2 classes with the same name in two separate projects in one solution?

I've got one solution right now, and it contains 3 separate projects. One project is a game engine, which I have given its own namespace and am now using in my other two projects. The other two projects are simple games that I have made as prototypes.
I am now working on my second game, and I am trying to add a class to the project that already exists in the first game. The second game is in no way dependent on the first game except for the fact that they use the same engine. Visual Studio will not let me add another class, it simply says "Object 'Bullet' already exists". Is there a way for me to force visual studio to make it anyway?
There is no reason for these to be conflicting, as far as I can tell, because they are separate projects with separate classes.
ATL simple object wizard - "Object Xxx already exists" error
Not exactly my problem, but basically. Seems to be an issue with visual studio thinking that the object exists because it has it cached that I created it. Made a Bullet2 and then renamed it and it worked fine.

Visual Studio UML Models for C++

I think this should be a simple yes or no answer.
I've added a UML modelling project to an existing standard C++ solution and added to it a reference to the C++ project (VS2015 Enterprise).
I would expect to see my existing C++ classes listed in the UML Model Explorer panel for me to drag onto the diagram, but I don't.
Is this simply because unmanaged C++ is not supported for this tool?
(I know I can right click on the project and do View... Class Diagram, but the diagram produced is not UML and won't even recognize STL containers as associations.)

How to load an entire Visual c++ project into Enterprise Architect to reverse engineer it?

Is there a way to load the DSW file for EA to then load the entire Visual C++ project?
AFAIK you can reverse engineer C++ code only from source code (header files) into EA.
There's also a VS AddIn available: MDG Integration for Visual Studio, but that comes at extra cost.
The best way to get around the 'spaghetti mess wiring' is to draw diagrams for the classes of your interest manually. You can use the 'Add related elements' command from the (diagram) context menu of the classes you pick, this might be helpful.
Don't expect to get into programming against a complex legacy library API just from class diagrams without further documentation, but class diagrams can be helpful though to get a bird's view of the API structure.