使用 libxml2
编译代码时出现编译错误。
文件 Reference.h
已存在于我的代码中,并被许多其他文件使用:
Reference.h
namespace reference // BEGIN OF namespace reference
{
}
但是当我使用 libxml2
编译代码时出现错误:
libxml2/libxml/SAX.h:116: error: 'void reference(void*, const xmlChar*)' redeclared as different kind of symbol
libxml2/libxml/SAX.h
XMLPUBFUN void XMLCALL reference (void *ctx,
const xmlChar *name);
有没有办法在不修改我的文件 Reference.h
的情况下解决此错误?
感谢您的帮助。
最佳答案
基本上,禁用SAX.h
。这是一个已弃用的接口(interface),它不费心做任何命名空间或为其符号使用任何标准前缀。相反,请使用 SAX2.h
,它(除了其他改进之外)为所有内容添加 xmlSAX2
前缀。
为了将已弃用的内容排除在 libxml2 之外,当您运行 configure
时,请确保不要传递 with_legacy
选项。
关于c++ - 'namespace reference { }' 的先前声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52150259/