Ok, I try to make application using xml library. My configuration data will be stored in xml files. So....
I downloaded library from here:
http://xml.apache.org/xerces-c/index.html
Ok, I have unpacked it to here:
/home/gandalf_bar/
So the library files are here:
/home/gandalf_bar/xerces/include
I have put the libraries to LD_LIBRARY_PATH so I can run the example without problem.
But I don't know how to compile one single application with this library. I try to read the document. But I cann't find it.
Consider this simple code:
When I do this:Code:#include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/dom/DOM.hpp> #include <xercesc/sax/HandlerBase.hpp> #include <xercesc/util/XMLString.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <iostream> using namespace std; int main( int argc, char* argv[] ) { try { XMLPlatformUtils::Initialize(); } catch( const XMLException& toCatch ) { char* message = XMLString::transcode( toCatch.getMessage() ); cout << "Error during initialization! :\n" << message << "\n"; XMLString::release( &message ); return 1; } }
$ g++ hello.cpp -o hello
hello.cpp:1:47: xercesc/parsers/XercesDOMParser.hpp: No such file or directory
hello.cpp:2:42: xercesc/util/PlatformUtils.hpp: No such file or directory
hello.cpp:3:38: xercesc/util/XMLString.hpp: No such file or directory
hello.cpp:4:31: xercesc/dom/DOM.hpp: No such file or directory
hello.cpp:5:39: xercesc/sax/HandlerBase.hpp: No such file or directory
hello.cpp:6:38: xercesc/util/XMLString.hpp: No such file or directory
hello.cpp:7:42: xercesc/util/PlatformUtils.hpp: No such file or directory
hello.cpp: In function `int main(int, char**)':
hello.cpp:15: error: `XMLPlatformUtils' undeclared (first use this function)
hello.cpp:15: error: (Each undeclared identifier is reported only once for each
function it appears in.)
hello.cpp:15: error: parse error before `::' token
hello.cpp:17: error: parse error before `&' token
hello.cpp:21: error: `message' undeclared (first use this function)
hello.cpp:22: error: `XMLString' undeclared (first use this function)
hello.cpp:22: error: parse error before `::' token
hello.cpp: At global scope:
hello.cpp:25: error: parse error before `}' token
But if I do this:
$ g++ -o hello hello.cpp -I /home/gandalf_bar/xerces/include
hello.cpp: In function `int main(int, char**)':
hello.cpp:15: error: `XMLPlatformUtils' undeclared (first use this function)
hello.cpp:15: error: (Each undeclared identifier is reported only once for each
function it appears in.)
hello.cpp:15: error: parse error before `::' token
hello.cpp:17: error: parse error before `&' token
hello.cpp:21: error: `message' undeclared (first use this function)
hello.cpp:22: error: `XMLString' undeclared (first use this function)
hello.cpp:22: error: parse error before `::' token
hello.cpp: At global scope:
hello.cpp:25: error: parse error before `}' token
So is there anyone outthere have experience using this xml parser library and want to help me compiling the application using this library?
Thank you.