24

I have added this to a class comment:

@link http://www.google.com Google @endlink

However, when I generate documentation using doxygen, the link text is indeed "Google", but the link is to:

file:///media/portable/Examples/Doxygen/link/html/classClass1.html

Can anyone explain what is going wrong?

Chris
  • 44,602
  • 16
  • 137
  • 156
David Doria
  • 9,873
  • 17
  • 85
  • 147

1 Answers1

41

I think you are using \link incorrectly. From the doxygen documentation, \link is used to refer to objects like a file, class or member and takes a reference to one of these as its first argument. For example, if I wanted to refer to a class method func in the class myClass, I would use

\link myClass::func link text ... \endlink

with all of the remaining arguments considered to be text for a link. I think your problem is that you do not pass a valid object as the first argument. I would guess that classClass1 is the next object in the file where you tried to include the link and this is what the \link command is refering to.

Linking to URLs

Doxygen will generate URL links automatically, so there is no need to surround the link with \link and \endlink or any other commands. So remove those and see if that fixes the problem.

To manually specify link text, use the HTML 'a' tag:

<a href="linkURL">link text</a> 

For more information about how doxygen handles automatic linking see this documentation page.

albert
  • 8,285
  • 3
  • 19
  • 32
Chris
  • 44,602
  • 16
  • 137
  • 156
  • When `myClass` is a complicated templated name and that Doxygen autolink breaks, is there a way to "capture" the symbol to link to when documenting `MyClass`? For example adding a `@alias MyClassAlias` in the `myClass` documention block and then be able to write `\link MyClassAlias link text ... \endlink ? – WaterFox Apr 28 '23 at 04:44
  • 1
    @WaterFox That sounds like a different question. If you're still looking for an answer, I'd suggest writing this up as a new question. – Chris May 17 '23 at 08:27