环境:
Ubuntu 18.04
安装:
sudo apt-get install doxygen
如果要使用图形工具,则
sudo apt-get install doxywizard
sudo apt-get install graphviz
如果doxywizard使用时报错,cannot find dot,就是没有安装graphviz。
如果不想安装graphviz,可以在doxywizard的“Wizard”->“Topics”->"Diagrams"中选择“No diagrams”或其他,反正不要选择“Use dot tool from the Graphviz package”就可以。
使用:
新建一个test目录,在目录下新建文件QTstyle_Test.h,如下
//! A test class.
/*!
A more elaborate class description.
*/
class QTstyle_Test
{
public:
//! An enum.
/*! More detailed enum description. */
enum TEnum {
TVal1, /*!< Enum value TVal1. */
TVal2, /*!< Enum value TVal2. */
TVal3 /*!< Enum value TVal3. */
}
//! Enum pointer.
/*! Details. */
*enumPtr,
//! Enum variable.
/*! Details. */
enumVar;
//! A constructor.
/*!
A more elaborate description of the constructor.
*/
QTstyle_Test();
//! A destructor.
/*!
A more elaborate description of the destructor.
*/
~QTstyle_Test();
//! A normal member taking two arguments and returning an integer value.
/*!
\param a an integer argument.
\param s a constant character pointer.
\return The test results
\sa QTstyle_Test(), ~QTstyle_Test(), testMeToo() and publicVar()
*/
int testMe(int a,const char *s);
//! A pure virtual member.
/*!
\brief just a member function.
\sa testMe()
\param c1 the first argument.
\param[out] c2 the second argument.
*/
virtual void testMeToo(char c1,char c2) = 0;
//! A public variable.
/*!
Details.
*/
int publicVar;
//! A function variable.
/*!
Details.
*/
int (*handler)(int a,int b);
};
在test目录中打开命令行,生成默认的doxygen配置文件(默认文件名为Doxyfile):
doxygen -g
生成默认的html和latex文档:
doxygen Doxyfile
用浏览器打开test/html文件夹下的index.html文件可以看到生成的文档。