Fedora 6使用log4cxx的版本為0.97
Fedora 6已被廣泛應用但是也在不斷的更新,這里介紹Fedora 6安裝設置使用,幫助大家安裝更新Fedora 6系統。花了一晚上時間編譯log4cxx, 總算通過了,這鳥工具,整S我了。
使用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了。#include <boost/cregex.hpp>以上兩個錯誤,花起來解決的時間都要4個小時。真是無語了。。。
【編輯推薦】