3

I'm new to Doxygen and recently run into a problem which I could not solve. I have this piece of documented code:

/*!
    \def nAsserts
    Uncomment that line so that all asserts would be removed
*/
//#define nAsserts

and it's supposed to tell the user to uncomment that line when they wish to remove all asserts but doxygen is returning me a warning:

warning: documentation for unknown define nAsserts found

I think the problem is that doxygen ignores all commented codes so is that any way to fix this or work around it?

1 Answer 1

4

Not sure if it is a best option, but you can use the approach below.

Modify configuration file to include PREDEFINED parameter:

ENABLE_PREPROCESSING = YES
MACRO_EXPANSION      = YES
EXPAND_ONLY_PREDEF   = YES
PREDEFINED           = "DOXYGEN=1"

In your code, do the following:

#if DOXYGEN
#define nAsserts
#endif

Doxygen follows own preprocessor and can conditionally include/exclude source module sections.

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

2 Comments

hey thanks now nAsserts shows up in the documentation but it doesn't have the line number attached like how a normal define does anyway to solve that?
Hey turns out the problem was on my part. Thanks for the solution it's working perfectly now. Cheers.

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.