10
votes

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)

1
The best that I can think of is just a link to the file, with a BOLD note telling the user to look at the function when they get there. You can auto-link, or use @see. Sorry that this isn’t much help. I would like to know the answer myself. If no luck here, then maybe to register and post you question to the DoxyGen users mailing list?Mawg says reinstate Monica

1 Answers

8
votes

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.