I'm using Eclipse Indigo while programming on c++. I'm using a code that provides extensive doxygen comments. I'd like to be able to see them inside eclipse, without having to use an external browser. I think the javadoc equivalent for that would be shift+F2
, but it doesn't work with c++ doxygen.
To put it in other words, when my mouse hovers over a method of a class, the tool tip provides the implementation of the function (found in the .cpp), instead of its declaration and the comments associated with it (found in the .h). I would like to see the latter in my tooltip.
Is there a solution for c++ users ?
Thanks
Unfortunately it's not possible and I doubt it will be ever possible in future. To explain in detail, read further.
In C++ you can write a function in 2 ways.
extern
, inline
or static
)Now eclipse chooses the implementation always and the reason for that is consistency. In C++ (unlike Java) you can have many forward declarations of a function in several header file, however the definition is always 1 (ODR).
If you bring the function under mouse, then which declaration to choose ? So it's better to choose a definition. Though this problem may not occur in the case of class methods.
Coming back to your question:
the tool tip provides the implementation of the function, instead of its declaration and the comments associated with it
The best way is to have comments embed with the implementation of the function. In other words, choose style-2 from below:
class A {
...
public:
/*
* description of the function
*/
void foo ();
};
void A::foo ()
{
...
}
class A {
...
public:
void foo ();
};
/*
* description of the function
*/
void A::foo ()
{
...
}
Workaround: Press the F3
key twice and it will lead you to the declaration via the definition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With