2022
我们一起努力

Fedora 6怎么使用log4cxx的版本为0.97

这篇文章主要介绍了Fedora 6怎么使用log4cxx的版本为0.97,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

使用log4cxx的版本为0.97 , OS为Fedora 6.   在make的过程中,首先碰到的问题就是:
../include/log4cxx/xml/domconfigurator.h:249: error: extra qualification
'log4cxx::xml::DOMConfigurator::' on member 'subst'

Fedora 6以上问题花了近二个小时,才找到答案, 答案见下:

Index: include/log4cxx/xml/domconfigurator.h   ===================================================================   --- include/log4cxx/xml/domconfigurator.h (revision 384243)   +++ include/log4cxx/xml/domconfigurator.h (working copy)   @@ -246,7 +246,7 @@   protected:   static LogString getAttribute(apr_xml_elem*,   const std::string& attrName);   -LogString DOMConfigurator::subst(const LogString& value);   +LogString subst(const LogString& value);

//要在源代码中把以上函数声明改成这句protected:
helpers::Properties props;

然后,编译到 /tests/src/util/filter.cpp 时,提示“‘RegEx’ 在此作用域中尚未声明”进入到filter.cpp文件中,看到该文件使用的是boost库中的regex功能。

#include <boost/regex.hpp> #include "filter.h"  using namespace log4cxx;  using namespace log4cxx::helpers;  using namespace boost;  String Filter::merge(const String& pattern, const String& in, const String& fmt)  {  USES_CONVERSION;  std::string convPattern = T2A(pattern.c_str());  std::string convIn = T2A(in.c_str());  std::string convFmt = T2A(fmt.c_str());   std::string result = RegEx(convPattern).Merge(convIn, convFmt);  return A2T(result.c_str());}

Fedora 6首先想到的是: gcc的时候“-lboost_regex”没有添加,在Makfile.in中添加编译选项:"-lboost_regex",还是出现该错误。

Fedora 6怎么使用log4cxx的版本为0.97

***,查看boost库源代码,发现RegEx函数定义在cregex.hpp中,而不是regex.hpp中,可能是boost库已经更新(把RegEx函数移到cregex.hpp中定义),而log4cxx却还是默认使用旧boost库的原因。

Fedora 6这个错误更改一下头文件编译就OK了。

感谢你能够认真阅读完这篇文章,希望小编分享的“Fedora 6怎么使用log4cxx的版本为0.97”这篇文章对大家有帮助,同时也希望大家多多支持云,关注云行业资讯频道,更多相关知识等着你来学习!

赞(0)
文章名称:《Fedora 6怎么使用log4cxx的版本为0.97》
文章链接:https://www.fzvps.com/46915.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!