使用Doxygen在另一个文件中插入功能链接? [英] Insert link to function in another file with Doxygen?

查看:138
本文介绍了使用Doxygen在另一个文件中插入功能链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个C源文件。在文件 A 中对函数 bar()的注释需要引用函数 foo ()在文件 B 中。我怎么做这个链接?

I have two C source files. A comment to a function bar()in file A needs to refer to a function foo() in file B. How can I make this link?

我试过:


  1. 编写如下内容: Bc :: foo()希望doxygen将转到文件 B 并找到函数 foo 那里。

  1. Writing something like: B.c::foo() hoping that doxygen would go to file B and find function foo there.

还尝试了 :: foo()但这没有帮助。

Also tried simply ::foo() but that did not help.

然后我尝试为文件 Bc 赋予特殊的标记名,如下所示在做 //!在 Bc 的第一行上@file specialtag ,然后执行 specialtag :: foo()在我的评论中,但并没有太大改变。

Then I tried giving file B.c a special tagname as in doing //! @file specialtag on first line of B.c and then doing specialtag::foo() in my comment but not much has changed.

我试图用 \ref 强制链接和 \link ,但即使那样也无济于事。

I tried to force the link with \ref and \link but even that did not help.

//!在 Ac Bc 中都存在@file 行,因此doxygen应该注意代码。

The //! @file line is present in both A.c and B.c so doxygen should be aware of the code.

编辑

我尝试了@doxygen的建议,但没有运气。我制作了一个示例项目来显示我在哪里遇到问题,在这里: http://www.filedropper.com/ testdoxygen2tar

I tried what @doxygen suggested but with no luck. I made an example project to show where I am running into problems, its here: http://www.filedropper.com/testdoxygen2tar

我使用了默认的安装文件,该文件是由 doxygen -g 制作的。
我得到的输出是:

I used the default setup file, made with doxygen -g. The output I am getting:

您可以看到foobar函数没有被链接。

You can see that the foobar function is not being linked to.

编辑2

发现了问题。函数 foo 没有记录,因此没有生成任何页面,因此doxygen当然没有链接的页面。 (我正在生成启用了 SOURCE_BROWSER 选项的文档,并希望会生成指向函数定义的链接)

Found the problem. Function foo was undocumented and so no page for it was generated, so of course doxygen had no page to link to. (I was generating documentation with the SOURCE_BROWSER option enabled and hoping that a link to function definition would be generated)

推荐答案

这非常简单。这是一个使用默认配置文件( doxygen -g )的最小示例:

This is pretty straightforward. Here's a minimal example that works with a default configuration file (doxygen -g):

首先创建文件foo。 c具有以下内容:

First create file foo.c with the following contents:

/** @file */

/** Function foo, see also bar(). */
void foo()
{
}

然后用以下内容创建文件bar.c:

then create file bar.c with the following contents:

/** @file */

/** Function bar, see also foo(). */
void bar()
{
}

运行doxygen,然后在HTML输出中观察到这两个函数将具有到另一个函数的链接。

Run doxygen and observe in the HTML output that both functions will have a link to the other function.

这篇关于使用Doxygen在另一个文件中插入功能链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆