3

I'm trying to generate documentation for a C# application using doxygen. Right now, I'm trying to create a mainpage that has some links to the central classes of the documented application.

I've created the page using markdown and it looks something like this:

\mainpage
Project name
==================
bla
Important classes
------------------
* Class1
* Class2
* Class3

For some reason, doxygen doesn't automatically generate links to the corresponding classes on this page. To makes things strange, doxygen has no problem recognizing these class names inside the code documentation, and generating the corresponding links, so, as far as I can tell, it's a mainpage problem.

Is there any way to do it, without using hardcoded links to the generated class pages?

3 Answers 3

9

I've been experimenting as I've a similar need - I've a mainpage written in Markdown too. This is essentially the same answer as Stephen's but with a bit more info. I'm using doxygen 1.8.5.

With AUTOLINK_SUPPPORT set to NO in the doxyfile:

It seems you need the fully qualified package name

com.bigcorp.stuff.product.namespace.ClassName

And you also need a reference command to make the link:

\ref com.bigcorp.stuff.product.namespace.ClassName

which does at least mean you can qualify the output text

\ref com.bigcorp.stuff.product.namespace.ClassName "ClassName"

means the output text doesn't have the namespace clutter.

With AUTOLINK_SUPPPORT set to YES (or blank):

You don't need the \ref i.e. com.bigcorp.stuff.product.namespace.ClassName will provide a link to the class just by itself, but does have the clutter so using a \ref might be cleaner anyway.

Just using ClassName still doesn't provide a link. Seems you need the package preamble.

Curiously, hovering over an automatically created link produces a pop-up description of the target class. However, an explicit \ref link does not.

1
  • Good explanation. It is strange that HIDE_SCOPE_NAMES does not work in this case, but it doesn't - I have tried.
    – Mikkel
    Apr 17, 2015 at 17:25
3

I finally got it! Prefixing the class name with the namespace name like Namespace1.Class1 did the trick!

This is still strange, as doxygen has no problem handling short class names in other places, but hey, it works!

0

I found how you can avoid adding a tedious \ref on each class and keep the class tooltip.

You can simply put your comment inside of the namespace.

namespace com.bigcorp.stuff.product.namespace
{
/// \page page_name Page Name
/// This is a working class auto ref -> ClassName.
}

This won't work for classes in multiple namespaces though...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.