我一直在尝试使用Doxygen来记录我的C++项目,但收效甚微:Doxygen无法识别某些宏,因此整个函数被错误解释,并且大部分时间都不会生成文档,即使它们有特殊的注释块。案例分析:对于上述类生成正确使用Doxygen
/**
* \def __MYLIB_FUNCTION_ATTRIBUTE(...)
* \brief Some brief comment
* \details Detailed doc
* \sa Some valid references
*/
#define __MYLIB_FUNCTION_ATTRIBUTE(...) __attribute__(__VA_ARGS__)
/**
* \def IN
* \brief Tag for input arguments to a function
* \details Blah...
* \sa OUT
*/
#define IN
/**
* \def OUT
* \brief Tag for output arguments to a function
* \details Blah...
* \sa IN
*/
#define OUT
class MyClass {
public:
/**
* \fn MyClass()
* \brief Constructor for MyClass
* \details Hi!
*/
__MYLIB_FUNCTION_ATTRIBUTE(__always_inline__)
MyClass() {
}
/**
* \fn const char *doNothing(const char *s IN)
* \brief A weird function
* \details Some very weird doc
* \param[in] s No good parameter
*/
const char* __SXC_FUNCTION_ATTRIBUTE(__const__) doNothing(const char *s IN) {
return s;
}
};
文档一直缺少doNothing
和IN
的描述被解释为功能!我在这里做错了什么?
什么是MACRO_EXPANSION等的值。 (http://www.doxygen.nl/config.html#cfg_macro_expansion)在你的配置文件? – 2010-04-15 15:51:45
@Eric:我认为你遇到了问题头! MACRO_EXPANSION设置为YES,但是是否还需要指定其他包含目录?目前所有使用的标题也都由Doxygen处理。我会回顾其余的参数并回复你。 – themoondothshine 2010-04-15 15:59:46
这里是配置PARAMS: 'ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES' – themoondothshine 2010-04-15 16:07:43