C++ 原型上的函数文档重复头文件->强力氧

发布于 2025-01-07 12:24:02 字数 415 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

萌酱 2025-01-14 12:24:02

如果您将 EXTRACT_ALL 设置为 NO 并且仅使用 (/** @file */) 记录头文件,那么 doxygen 将仅显示标头并且仍然包含在函数定义中找到的文档。

如果您同时记录头文件和源文件,或者将 EXTRACT_ALL 设置为 YES,那么 doxygen 会将函数的文档显示为头文件的一部分和源文件文档的一部分。这是功能,不是错误:-)

If you set EXTRACT_ALL to NO 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 to YES, 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 :-)

も星光 2025-01-14 12:24:02

您应该复制函数原型而不是实现。但也许只需将 HIDE_UNDOC_MEMBERS 设置为 YES 就可以解决您的问题。

You should duplicate the function prototype and not the implementation. But maybe just setting HIDE_UNDOC_MEMBERS to YES could fix your problem.

夜空下最亮的亮点 2025-01-14 12:24:02

配置 doxygen 按名称空间而不是文件对自由函数进行分组。

Configure doxygen to group free functions by namespace, not by file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文