Generating documentation from source code

When you are documenting your code, it can be of great use to have a separate document that describes your code and project in a condensed form. This guide shows you how to use Doxygen for this purpose.

The easiest way to set up doxygen is to download and install it on Ubuntu. Information about installing and setting up on other systems can be found on Doxygen's webpage. To install on Ubuntu, type the following command in a terminal:

sudo apt-get install doxygen doxygen-gui doxygen-latex

After this, you may go to your source code folder and type

doxygen -g Doxyfile

This will generate a default doxygen setup file named Doxygen. You may edit this file by hand or use Doxygen GUI by typing in a terminal:

doxywizard

After setting it up, you may run doxygen from the gui or the terminal:

doxygen

After this, two new folders should have been created, latex and html. We urge you to add the html documentation to your git repository.

Generating LaTeX documentation

After running doxygen, go to the latex folder, and run make to compile the latex document:

cd latex
make

LaTeX is however not such a nice format for documentation, so you should take some time to edit the default settings of Doxygen to make the output nicer.
 

By Svenn-Arne Dragly
Published Jan. 16, 2014 1:23 PM