Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert link to function in another file with Doxygen?

Tags:

c

doxygen

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?

I tried:

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

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

  3. 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.

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

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

EDIT

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

I used the default setup file, made with doxygen -g. The output I am getting: Firefox showing the page generated by doxygen

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

EDIT 2

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)

like image 632
user10607 Avatar asked Feb 13 '26 09:02

user10607


1 Answers

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

First create file foo.c with the following contents:

/** @file */

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

then create file bar.c with the following contents:

/** @file */

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

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

like image 169
doxygen Avatar answered Feb 15 '26 00:02

doxygen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!