I'm developing a cross-platform library. Some pieces of code are platform dependent, so I have to separate them using #ifdef
, checking the platform type. I split one class into two classes, each for their own platform. These classes have different names, but finally I need to typedef
these classes to one type according to the platform:
#ifdef UNIX
/** some comment */
typedef Key_unix Key;
#elif WIN
/** another comment */
typedef Key_win Key;
#endif
The generated documentation is showing only the first typedef
with both comments. How can I show both typedef
s together, each with its own comment?
From what I understand, doxygen has its own preprocessor that will evaluate #ifdefs. You can define macros using the PREDEFINED
option.
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed. To prevent a macro definition from being
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
However, since you've got an #elif even if you set PREDEFINED = UNIX WIN
it'll only evaluate the first #ifdef. As an alternative you could always try:
#ifdef UNIX
/** some comment */
typedef Key_unix Key;
#endif
#ifdef WIN
/** another comment */
typedef Key_win Key;
#endif
It's unlikely that you'll have both UNIX and WIN defined when you compile the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With