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

41次阅读
没有评论

共计 1644 个字符,预计需要花费 5 分钟才能阅读完成。

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

使用 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 , 还是出现该错误。

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

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

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

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-25发表,共计1644字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)