I have noticed that Doxygen can link member functions calls from instances, when the default constructor takes no arguments, but fails to link them, when the constructor takes arguments.
- Why is that?
- Is there a workaround to manually add links within a
@code/@endcodeblock?
In the example below:
t.foo()–foo()is linkedu.foo()–foo()is not linked
.
/** @file doxy.cpp */
/** struct T */
struct T {
/** foo */
void foo() { }
};
/** struct U */
struct U {
int a; /**< int a */
/** U */
U(int a_) : a(a_) { }
/** foo */
void foo() { }
};
/**
* main
*
* @code
* T t;
* t.foo(); // foo is linked
*
* U u(42);
* u.foo(); // foo is not linked
* @endcode
*/
int main()
{
return 0;
}
I think this is a symptom of a known issue in Doxygen. From http://www.doxygen.nl/manual/trouble.html
So in this case, I believe:
is being interpreted as a function instead of as a variable declaration.
Unfortunately, I’m not aware of any options for explicitly adding links within a code block. The only workaround I’ve found is to restructure the code so that the declaration doesn’t look like a function to Doxygen. For example, changing your variable initialization to this:
allows Doxygen to recognize
uas a variable instead of a function.