3

I am trying to add a function to multiple groups but it does not seems to be working.

I followed the instructions from here

Here are the comments I added:

/**
 * \defgroup version1 version 1
 */

/**
 * \defgroup version2 version 2
 */

/**
 * \ingroup version1 version2
 */
BOOL CLoginFormDlg::OnInitDialog(){}

The function only appears in the version2 module and not in the version1 module.

if I write version1 last like this:

/**
 * \ingroup version2 version1
 */
BOOL CLoginFormDlg::OnInitDialog(){}

then the function only appears in the version1 module and not the version2 module.

I would like them to appear in both modules

1 Answer 1

2

The link you provided includes a paragraph that explains why it doesn't work:

Note that compound entities (like classes, files and namespaces) can be put into multiple groups, but members (like variable, functions, typedefs and enums) can only be a member of one group (this restriction is in place to avoid ambiguous linking targets in case a member is not documented in the context of its class, namespace or file, but only visible as part of a group).

One approach to consider to solve this problem might be to create different Doxygen projects for each version of your code. You would create a Doxyfile for each version.

In this case, instead of trying to include common code in both sets of documentation using the \ingroup command, you would be excluding unrelated code from each set using conditional sections delimited by either \if...\endif or \cond...\endcond.

So in your version1 module, you would do the following:

/**
 * \if _VERSION1_
 */

    <all code in your version1 module>

/**
 * \endif
 */

and in your version2 module:

/**
 * \if _VERSION2_
 */

    <all code in your version2 module>

/**
 * \endif
 */

Code that needs to appear in both modules, such as your BOOL CLoginFormDlg::OnInitDialog(){} function, would have no such conditional commands, so would be included in both sets of documentation.

In your version1 Doxyfile, add the following line:

ENABLED_SECTIONS = _VERSION1_

and in your version2 Doxyfile:

ENABLED_SECTIONS = _VERSION2_

To link your version1 and version2 documentation sets together, you can use Doxygen's tag file mechanism.

See also

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.