Doxygen @link to a URL doesn't generate the link correctly

David Doria picture David Doria · Feb 1, 2012 · Viewed 18.4k times · Source

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?

Answer

Chris picture Chris · Feb 1, 2012

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.