How to configure Doxygen for C++ code

If you do not use an IDE, then Doxygen is a heaven-send for understanding and working with a huge C++ codebase. To make your life easier, you can configure Doxygen to give you as much information as possible in its documentation. Here are the settings I use for C++ code:

Doxywizard

If the project does not have a Doxyfile configuration file, then using Doxywizard is a convenient way to generate this file. I like to use its Wizard mode to quickly set the most important settings.

  • In the Mode topic, for Select the desired extraction mode choose All Entities. Also enable the Include cross-referenced source code in the output option.

  • In the Mode topic, choose Optimize for C++ output.

  • In the Output topic, choose HTML with navigation panel and search function.

  • In the Diagrams topic, choose to use Dot from the GraphViz package. Choose to generate Dot graphs for all the possible entities, including generating header include graphs.

Configuration file

In the configuration file, I like to enable a few more options:

BUILTIN_STL_SUPPORT = YES

# Show private members of class
EXTRACT_PRIVATE = YES

# Show static members of class
EXTRACT_STATIC = YES

# Show members of anonymous namespace
EXTRACT_ANON_NSPACES = YES

# Show which header file to include to use this class or member
SHOW_GROUPED_MEMB_INC  = YES

# Add all the header and source file extensions used
FILE_PATTERNS = *.cpp *.h *.hpp

# Function source code shown inline
INLINE_SOURCES = YES

# Show all functions that reference current function
REFERENCED_BY_RELATION = YES

# Show all functions referenced by current function
REFERENCES_RELATION = YES

# Generate class diagrams for base class
CLASS_DIAGRAMS = YES

# Number of threads to use for DOT
DOT_NUM_THREADS = 4

# Use UML notation for class diagrams
UML_LOOK = YES

# Show all members in UML class
UML_LIMIT_NUM_FIELDS = 0

# Show relationship for templates in graphs
TEMPLATE_RELATIONS = YES

To get started quickly, I have shared my Doxyfile for C++ and CUDA code here. Just look for foobar in the file and replace with your project name and directories.

Tried with: Doxygen 1.8.6 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s