CLion 2024.1 Help

Doxygen documentation

Doxygen-style comments can be placed across the source code and used for generating fully-fledged documentation in various formats.

CLion includes the information from doxygen into the Quick Documentation popup Ctrl+Q:

Doxygen comments in Quick Documentation

Viewing doxygen documentation

Doxygen-styled information is included in Quick Documentation popup in addition to the type information. To invoke the documentation popup:

  1. Place the caret at the desired symbol or at the @param command of the doxygen comment.

  2. Press Ctrl+Q.

Alternatively, when the checkbox Show quick documentation on hover (Settings | Editor | General | Other) is selected, you can just move your mouse pointer over the desired symbol.

If function parameters are documented separately from the function description, CLion will merge all the comments and show you the full function’s signature documentation (the same way as doxygen does when generating the output) :

merged Doxygen comments

Creating doxygen comments

To create a doxygen comment from scratch:

  1. Type one of the following symbols: ///, //!, /** or /*! and press Enter.

  2. You will get a stub to fill with the documentation text:

    Generate comments

To change the prefix type or to add the @brief tag:

  1. In CLion Classic, go to Settings | Editor | Code Style | C/C++.

    In CLion Nova, go to Languages & Frameworks | C/C++ | Code Generation.

  2. Open the Code Generation tab and scroll down to the Documentation Comments section:

    Doxygen comments settings

    Scroll down to the Documentation Comment Template section:

    Doxygen comments settings

Reliable rename

While renaming a function or its parameters, the doxygen comments need to be updated accordingly. In case of the Rename refactoring Shift+F6, CLion updates doxygen comments along with other references.

Before:

Renaming example - before

After:

Renaming example - after

Typing assistance

Basic typing assistance for doxygen commands is provisioned by CLion auto-complete feature:

Typing assistance for doxygen commands

Note that not all the commands are available in the completion. Here you can find the list of the commands that are currently unsupported.

Rendered view for doxygen comments

With CLion, doxygen comments can be shown in an easier-to-read format. In this Rendered View mode, items are shown grouped by their tags, while the tags themselves are skipped.

Toggling rendered view for doxygen comments

Note the rendered view limitations:

  • Opening the referenced web pages is not available.

  • EOL block comments are rendered only if they start the line.

Toggle and configure the rendered view

  • To enter the Rendered View mode, hover over a comment and click the Toggle Rendered View icon in the gutter or press Ctrl+Alt+Q. The icon turns into the Toggle Rendered View icon.

    Gutter icon for toggling rendered view
  • To quit the Rendered View mode, click the Toggle Rendered View icon in the gutter, or select Toggle Rendered View from the context menu of a doxygen comment, or press Ctrl+Alt+Q.

    Turning off rendered view
  • To turn on the Rendered View mode for all doxygen comments in the current file, select Render All Doc Comments from the context menu in the gutter.

    Enabling rendered view for all doxygen comments
  • If necessary, select Adjust Font Size from the context menu and change the font size using the slider.

    Adjusting the font size in rendered view
  • To show all doxygen comments rendered by default, open the Settings dialog (Ctrl+Alt+S) , go to Editor | General | Appearance, and select the Render documentation comments checkbox.

    Turn on Rendered doxygen comments by default
  • To hide the Rendered View gutter icons, select Configure Gutter Icons from the context menu in the gutter and then clear the Documentation comments in-place rendering checkbox on the Settings | Editor | General | Gutter Icons page that opens.

Doxygen comments colors

To configure the colors that are used in doxygen comments, go to Settings | Editor | Color Scheme | C/C++ and open the Comments | Doxygen node:

Doxygen comments colors
Last modified: 26 May 2024