Can Eclipse hover tips display Doxygen comments from header file?

前端 未结 2 1023
忘了有多久
忘了有多久 2020-12-29 03:45

I\'m using Eclipse CDT to write C++ code. Having read several discussions here on StackOverflow about whether to place doxygen documentation in the header file or the imple

相关标签:
2条回答
  • 2020-12-29 04:15

    I found a workaround for this problem, however it's pretty inconvenient for general use.

    If you're using an external build system (make/cmake eg.) where eclipse is unable to pass on it's macro definitions, then all you need to do is place the implementation in it's own include guard and add the include guards macro to eclipse's symbol definitions. This will hide that section of code from eclipse, forcing it to use the intended comments without affecting the build.

    For example:

    #ifndef INCLUDE_GUARD_FOR_IMPLEMENTATION
    #define INCLUDE_GUARD_FOR_IMPLEMENTATION
    
    // Implementation code
    
    #endif
    

    and then in project -> properties -> C/C++ General -> Paths And Symbols add INCLUDE_GUARD_FOR_IMPLEMENTATION under the symbols section.

    It does of course have the side effect of greying out the section, and if you can't or don't want to put the implementation code in a separate header it might look rather out of place.

    0 讨论(0)
  • 2020-12-29 04:24

    Doxygen comments are displayed in Eclipse on hover when written in:

    • cpp file (or header) file before method source (not declaration)
    • header file before class declaration
    0 讨论(0)
提交回复
热议问题