3
我一直在使用RapidXML解析字符串時遇到了一些麻煩。我在Eclipse中收到一個錯誤,聲稱解析函數不存在。RapidXML編譯錯誤解析字符串
make all
Building file: ../search.cpp
Invoking: Cross G++ Compiler
g++ -DDEBUG -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"search.d" -MT"search.d" -o "search.o" "../search.cpp"
../search.cpp: In function ‘void search(CURL*, CURLcode, std::string, std::string)’:
../search.cpp:29:27: error: no matching function for call to ‘rapidxml::xml_document<>::parse(const char*)’
../search.cpp:29:27: note: candidate is:
../rapidxml-1.13/rapidxml.hpp:1381:14: note: template<int Flags> void rapidxml::xml_document::parse(Ch*) [with int Flags = Flags, Ch = char]
make: *** [search.o] Error 1
下面的代碼引發錯誤:
rapidxml::xml_document<> doc; // This has no errors
doc.parse<0>(data.c_str()); // This line raises the error (data is a string)
僅供參考這裏的在線文檔: http://rapidxml.sourceforge.net/manual.html#namespacerapidxml_1parsing
RapidXML來自四個頭文件:
- rapidxml_iterators。 hpp
- rapidxml_print.hpp < --contains錯誤,但構建成功與他們
- rapidxml_utils.hpp < --contains錯誤,但構建成功與他們
- rapidxml.hpp <通過程序--linked,包含分析功能
如何解決我的代碼中的錯誤,並首先需要如此解決頭中的編譯器錯誤?
感謝您的支持!這讓我瘋狂! – stephenwebber 2012-08-01 03:51:59
或者,您可以通過調用parse指向字符串第一個成員的指針來避免複製。 'doc.parse <0>(&str [0]);' – Hydranix 2016-12-02 04:28:14
@Hydranix我嘗試了你的方法,但沒有奏效。我仍然試圖找出解析字符串的方法,而不必通過將字符串複製到char數組來複制內存。如果我找到答案,我會在這裏發佈答案。 – 2017-05-22 18:27:31