Gauthier Boaglio
Gauthier Boaglio

Reputation: 10242

Eclipse CDT methods comments autogeneration using Doxygen style

Hope this is not a duplicate... It should not since I tried the usual provided fixes.

I'm facing problems with the automated generation of comments for Classes and Methods using Elipse CDT (Juno/3.8, Linux) configured with Doxygen as default Documentation Tool.

I still get empty comments area for methods parameters while typing /** + ENTER :

/**
 *
 */

Here is what I already tried without success :

Both lead to the same result.

Note : not sure about what happened with Eclipse configuration (it used to work fine before). Is that possible that I erased the Doxygen presets (maybe by pressing Windows > Preferences > C/C++ > Code Style > Code Templates > Restore Defaults). In that case how to get it back to Doxygen style ?

EDIT: I've got some new on the subject...

Basically, it was a global change in my project (which actually is a shared library). For some cross-platform portability reasons, I had to add a MACRO before all my classes, like follows :

class LIB_CLASS LabOneOfMyClasses {
public:
   ...
}

Unfortunately, doing this seems to break CDT's ability to generate smart functions headers (@param, @return, ...). So removing temporarily the MACRO, allows to get ride of this disagreeable behavior. It is annoying and is something I should report to CDT's staff...

Note : In the end, it is handled properly in Doxygen, anyway.

If someone has a brilliant idea, something I missed, about that ?

Upvotes: 2

Views: 4404

Answers (1)

user2649957
user2649957

Reputation: 21

You can create a compiler abstraction header to solve this issue. Define a custom symbol in eclipse for your build configuration. Go to Project > Properties > C/C++ General > Paths and Symbols > Symbols > GNU C/C++ in eclipse and define a new unique symbol like #__ECLIPSE_CDT__.

Than in the compiler abstraction header you can write the followings:

#ifdef __ECLIPSE_CDT__
#  define LIB_CLASS
#else
#  define LIB_CLASS <required normal content>
#endif

And if you consistently include this compiler abstraction header into your files than eclipse will expand LIB_CLASS to nothing while your compiler will find and use the proper definition.

Upvotes: 2

Related Questions