您好,登錄后才能下訂單哦!
這篇文章主要介紹了Fedora 6怎么使用log4cxx的版本為0.97,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
使用log4cxx的版本為0.97 , OS為Fedora 6. 在make的過程中,首先碰到的問題就是:
../include/log4cxx/xml/domconfigurator.h:249: error: extra qualification
'log4cxx::xml::DOMConfigurator::' on member 'subst'
Fedora 6以上問題花了近二個(gè)小時(shí),才找到答案, 答案見下:
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 時(shí),提示“‘RegEx’ 在此作用域中尚未聲明”進(jìn)入到filter.cpp文件中,看到該文件使用的是boost庫(kù)中的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的時(shí)候“-lboost_regex”沒有添加,在Makfile.in中添加編譯選項(xiàng):"-lboost_regex",還是出現(xiàn)該錯(cuò)誤。
***,查看boost庫(kù)源代碼,發(fā)現(xiàn)RegEx函數(shù)定義在cregex.hpp中,而不是regex.hpp中,可能是boost庫(kù)已經(jīng)更新(把RegEx函數(shù)移到cregex.hpp中定義),而log4cxx卻還是默認(rèn)使用舊boost庫(kù)的原因。
Fedora 6這個(gè)錯(cuò)誤更改一下頭文件編譯就OK了。
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Fedora 6怎么使用log4cxx的版本為0.97”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。