您应该将所有必要的文档放在外部文件中。我不知道该怎么做,但我尝试建立一个像你这样的最小环境并且效果很好。只是为了记录我在 Doxygen 网站上获取的示例代码:
test1.h:
#define MAX(a,b) (((a)>(b))?(a):(b))
typedef unsigned int UINT32;
int errno;
int open(const char *,int);
int close(int);
size_t write(int,const char *, size_t);
int read(int,char *,size_t);
并编写了完全没用的 test2.h(只是为了有两个不同的文件...):
void itdoesnothing();
好的部分来了。我制作了一个外部标题,只是为了记录上面的内容,称为 test_doc.h(同样,只是使用了 Doxygen 网站上的示例):
/*! \addtogroup everything The main group
This group contains everything.
@{
*/
/*! \file test.h
\brief A Documented file.
Details.
*/
/*! \def MAX(a,b)
\brief A macro that returns the maximum of \a a and \a b.
Details.
*/
/*! \var typedef unsigned int UINT32
\brief A type definition for a .
Details.
*/
/*! \addtogroup err Error handling
Error handling related stuff
@{
*/
/*! \var int errno
\brief Contains the last error code.
\warning Not thread safe!
*/
/*! @} */
/*! \addtogroup fdrelated File description related
File descriptor related stuff.
@{
*/
/*! \fn int open(const char *pathname,int flags)
\brief Opens a file descriptor.
\param pathname The name of the descriptor.
\param flags Opening flags.
*/
/*! \fn int close(int fd)
\brief Closes the file descriptor \a fd.
\param fd The descriptor to close.
*/
这成功地记录了 Doxygen 的两个文件。这样您也可以对文件、命名空间等进行分组,如手册中所述:
组的成员可以是文件、命名空间、类、函数、变量、枚举、类型定义和定义,也可以是其他组。
所以也尝试阅读http://www.doxygen.nl/grouping.html,看看我上面提到的事情可以做些什么。祝你好运!