Doxygen(1.8.10)抱怨说我的字符串的值没有记录.这是一个演示问题的最小例子
#include <string>
struct MyStruct ///< Docs for struct
{
std::string a; ///< Docs for a
std::string b; ///< Docs for b
};
class MyClass ///< Docs for class
{
static struct MyStruct instance; ///< Docs for instance
};
struct MyStruct MyClass::instance = {"firstVal", "secondVal"};
这会导致警告
/tmp/example.cpp:10: warning: Member firstVal (variable) of class MyClass is not documented.
如果我将结构减少到单个成员并从初始化程序中删除“secondVal”,则警告消失,但显然这不是解决方案……
最佳答案 只需删除额外的结构.如:
#include <string>
struct MyStruct ///< Docs for struct
{
std::string a; ///< Docs for a
std::string b; ///< Docs for b
};
class MyClass ///< Docs for class
{
static struct MyStruct instance; ///< Docs for instance
};
MyStruct MyClass::instance = {"firstVal", "secondVal"};
C不要求您使用struct MyStruct,而是允许您只使用普通的MyStruct.做这个微小的改变使得警告消失了doxygen 1.8.13.