共計(jì) 1644 個字符,預(yù)計(jì)需要花費(fèi) 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);
// 要在源代碼中把以上函數(shù)聲明改成這句 protected:
helpers::Properties props;
然后,編譯到 /tests/src/util/filter.cpp 時,提示“‘RegEx’在此作用域中尚未聲明”進(jìn)入到 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 中添加編譯選項(xiàng):-lboost_regex , 還是出現(xiàn)該錯誤。
***,查看 boost 庫源代碼,發(fā)現(xiàn) RegEx 函數(shù)定義在 cregex.hpp 中,而不是 regex.hpp 中,可能是 boost 庫已經(jīng)更新(把 RegEx 函數(shù)移到 cregex.hpp 中定義),而 log4cxx 卻還是默認(rèn)使用舊 boost 庫的原因。
Fedora 6 這個錯誤更改一下頭文件編譯就 OK 了。
感謝你能夠認(rèn)真閱讀完這篇文章,希望丸趣 TV 小編分享的“Fedora 6 怎么使用 log4cxx 的版本為 0.97”這篇文章對大家有幫助,同時也希望大家多多支持丸趣 TV,關(guān)注丸趣 TV 行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!