How to Create documentation using Doxygen in Ubuntu
July 7, 2016 ·
5 mins read
Categories:
doxygen
|
documentation
|
Doxygen is a tool to create documentation for your program/project written in languages like
C
, C++
, Java
, Python
and so on. It reads the well-formatted and special Doxygen comments to create the required documentation. This documentation is very important for the new developers who want to help in the development of the project.
Documentation is one of the main pillars of an open-source project.
Read this post to know more about the importance of documentation in software development.
Let us discuss how to create documentation using Doxygen. First of all, you need to have Doxygen installed on your system. For that, you can type these commands in the terminal.
sudo apt-get update
sudo apt-get install doxygen
sudo apt-get install doxygen-gui
Now you can run the GUI using the command.
doxywizard
Now that’s it for the GUI. In this guide, we are going to create the documentation using the terminal. Excited… so am I.
So, let’s start. For the example purpose, I am going to create a simple hello world
program in C++(The strategy is different for python but is similar to many other languages whose support is present).
This is what program looks like :-
/**
* @file helloworld.cc
* @brief helloworld
* @detail this is a simple hello world program using a function
* @author Ranvir
* @include string.h
*/
#include <iostream>
using namespace std;
/**
* @class hello
* @brief simple brief intro
* @detail detailed intro
*/
class hello{
public:
/**
* @class hello
* @fn helloworld
* @brief print helloworld on the terminal
*/
void helloworld(){
cout<<"hello world";
}
};
int main(){
cout<<"Hello world";
cout<<"\n";
hello obj1;
obj.hello();
return 0;
}
-
/** ----------- comments */
-
/// single line comment in Doxygen
-
""" special comment block for python """
-
/*! comment */
-
@
-
\
@
in the shown example. We can also use \
in place of @
.
Now we need to generate the configuration file for the project. The configuration file contains the content in which the various variables of the Doxygen file are defined. While you are in the directory where your project is present. You can also create a separate folder for the Doxygen content. For this purpose use this command.
$ doxygen -g filename
$ vim Doxygen
Vim: The best text Editor for editing your files everywhere
#Six weeks training
#vim
#text-editor
#programming
June 9, 2016
7 mins read
$ doxygen Doxygen
$ cd html
$ firefox index.html
$ cd ..
$ cd latex
$ make
Please share your Feedback:
Did you enjoy reading or think it can be improved? Don’t forget to leave your thoughts in the comments section below! If you liked this article, please share it with your friends, and read a few more!