C++ 原型上的函数文档重复头文件->强力氧
Doxygen 在遇到函数原型时会重复函数文档 头文件,例如:
code:
#include <File main.h>
void Func1(void);
///File main.c:
#include <main.h>
/*! Main program entry point. */
main()
{
Func1();
}
/*! Test function which does nothing. */
void Func1(void)
{
return;
}
为 Func1() 生成两批文档:第一个在 main.c 中 文档,第二个位于 main.h 文档中。带着一个大项目, 由于重复、冗余,这几乎使文档的大小增加了一倍 功能文档。这是一个错误还是某些配置问题?
Doxygen repeats function documentation when it encounters function prototypes in
header files, for example:
code:
#include <File main.h>
void Func1(void);
///File main.c:
#include <main.h>
/*! Main program entry point. */
main()
{
Func1();
}
/*! Test function which does nothing. */
void Func1(void)
{
return;
}
generates two lots of documentation for Func1(): the first in the main.c
documentation, and the second in the main.h documentation. With a large project,
this almost doubles the size of the documentation with repeated, redundant
function documentation. Is this a bug or some configuration problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您将
EXTRACT_ALL
设置为NO
并且仅使用 (/** @file */
) 记录头文件,那么 doxygen 将仅显示标头并且仍然包含在函数定义中找到的文档。如果您同时记录头文件和源文件,或者将
EXTRACT_ALL
设置为YES
,那么 doxygen 会将函数的文档显示为头文件的一部分和源文件文档的一部分。这是功能,不是错误:-)If you set
EXTRACT_ALL
toNO
and only document your header files using (/** @file */
) then doxygen will only show the headers and still include the documentation found at the function's definition.If you document both header and source file or set
EXTRACT_ALL
toYES
, then doxygen will show the documentation of the function as part of the header and as part of the source file documentation. This is feature, not a bug :-)您应该复制函数原型而不是实现。但也许只需将
HIDE_UNDOC_MEMBERS
设置为YES
就可以解决您的问题。You should duplicate the function prototype and not the implementation. But maybe just setting
HIDE_UNDOC_MEMBERS
toYES
could fix your problem.配置 doxygen 按名称空间而不是文件对自由函数进行分组。
Configure doxygen to group free functions by namespace, not by file.