9
votes

I have a C project that I document with doxygen. I also use graphviz to generate collaboration diagrams for my structures. The problem is that for structures, which their members are simple types (int, float, etc) or their members are defined outside the project (and included via an include file) no collaboration diagram is generated.

How can I force doxygen to generate a diagram for those structures?

For example, say I have the following structure:

/** This is my simple struct. */
typedef struct 
{
    /** A member */
    int a_member;

    /** Another member */
    int another_member;
} my_simple_struct_t;

If you have a struct like this, Doxygen will not generate a collaboration diagram (it will provide a documentation entry for the struct though). How can I force it to create one and show that it is a structure of two integers?

1
I'm not sure I follow exactly, but are the structures you are trying to generate collaboration diagrams for documented at all? If not you will have to set the EXTRACT_ALL configuration file option to YES.Chris
The structure IS documented by Doxygen. The problem is that Doxygen does not generate a collaboration diagram for it. I have other, more complex structures in my project (i.e. structures which their members are also documented structures) that DO get a collaboration diagram.Kostas
As far as I know doxygen only generates collaboration graphs for each class, not structs. Structs will only appear in the diagram if they are a member of one or more classes (see figure 1 of this tutorial. Why don't you try adding \callgraph and \callergraph commands in your struct documentation.Chris
I think Doxygen treats structures in much the same way as classes. In any case, I get a nice collaboration diagram for all my structs that consist of other structs, but not for structs that contain simple types.Kostas
I think the \callgraph and \callergraph commands regard functions or methods and not structs or classes.Kostas

1 Answers

16
votes

With the following settings doxygen will produce a collaboration diagram for the above structure:

HAVE_DOT             = YES
COLLABORATION_GRAPH  = YES
HIDE_UNDOC_RELATIONS = NO