简体   繁体   中英

How do I get Doxygen to expand macros from include files?

I have a number of multiline macros defined in a file called macros.h. In my doxyfile, I've got

ENABLE_PREPROCESSING   = YES
MACRO_EXPANSION        = YES
EXPAND_ONLY_PREDEF     = NO
PREDEFINED             =
EXPAND_AS_DEFINED      =
SKIP_FUNCTION_MACROS   = NO

yet Doxygen still will not expand the macros in any source file that includes macros.h. I ran "doxygen -d Preprocessor doxyfile" to see the output of the preprocessor, and it outputs messages like:

#include macros.h: not found or already included! skipping...

You've told your compiler about your include path, but you haven't told doxygen. So it tries to open "macros.h" and gets a file-not-found error.

You need to properly set INCLUDE_PATH in your Doxyfile.

@Ben: Have you actually gotten INCLUDE_PATH to work?

I understand the theory. I have set up the INCLUDE_PATH as explained (in both absolute and relative forms) but to no avail. I have set INCLUDE_FILE_PATTERNS to *.h. Nonetheless, when processing my .cpp files Doxygen finds all of the headers in the INPUT directory yet fails to find any headers in my lib/ subdirectory.

The only solutions I have found are:

1) Create a symbolic link within the INPUT directory to each header in its lib/ subdirectory. This is ugly and ungeneralizable.

2) Set the RECURSIVE tag to YES. This is undesirable because now the entire contents INPUT's tests/ subdirectory get added to the generated documentation.

I am inclined to believe that INCLUDE_PATH functionality is simply broken (at least in version 1.7.1 that I am running).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM