您应该将所有必要的文档放在外部文件中。我不知道如何做到这一点,但我试着建立一个像你这样的最小环境,而且效果很好。为了记录一些东西,我在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记录了两个文件。这样,您也可以对文件、名称空间等进行分组,如手册中所述:
组的成员可以是文件、命名空间、类、函数、变量、枚举、typedef和defines,也可以是其他组。
所以尝试阅读
http://www.doxygen.nl/grouping.html
也可以看看如何处理我上面提到的事情。祝你好运!