如何让 Doxygen 从包含文件中扩展宏?
我在名为 Macros.h 的文件中定义了许多多行宏。在我的 doxyfile 中,
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
Doxygen 仍然不会扩展任何包含 Macros.h 的源文件中的宏。我运行“doxygen -d Preprocessor doxyfile”来查看预处理器的输出,它输出如下消息:
#include macros.h: not found or already included! skipping...
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您已经告诉编译器您的包含路径,但还没有告诉 doxygen。因此它尝试打开“macros.h”并收到文件未找到错误。
您需要在 Doxyfile 中正确设置 INCLUDE_PATH 。
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:你真的让 INCLUDE_PATH 开始工作了吗?
我明白这个理论。我已经按照解释设置了 INCLUDE_PATH (以绝对和相对形式),但无济于事。我已将 INCLUDE_FILE_PATTERNS 设置为 *.h。尽管如此,在处理我的 .cpp 文件时,Doxygen 找到了 INPUT 目录中的所有标头,但未能在我的 lib/ 子目录中找到任何标头。
我找到的唯一解决方案是:
1)在 INPUT 目录中创建到其 lib/ 子目录中每个标头的符号链接。这是丑陋且不可概括的。
2) 将 RECURSIVE 标签设置为 YES。这是不可取的,因为现在 INPUT 的测试/子目录的全部内容都被添加到生成的文档中。
我倾向于认为 INCLUDE_PATH 功能完全被破坏了(至少在我运行的版本 1.7.1 中)。
@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).