From: tim <ti...@st...> - 2003-09-03 00:14:26
|
Hi Guys I am writting a c++ app and need xml support so i thought i would give=20 libxml++ a try. Anyways i can not get anything to compile, i am using Deb= ian=20 3.0r1 I am using kdevelop 2.1. I tried a few of the examples that comes w= ith=20 libxml++ but none of them compile for eg (import node example) #include <iostream> #include <stdexcept> #include <string> #include <cstdlib> #include <libxml++/libxml++.h> using namespace xmlpp; using namespace std; int main (int argc, char *argv[]){ try { DomParser example1("example1.xml"); DomParser example2("example2.xml"); Document *doc1 =3D example1.get_document(); Document *doc2 =3D example2.get_document(); Element *root1 =3D doc1->get_root_node(); Element *root2 =3D doc2->get_root_node(); // find the first "child" element in example2 Node::NodeList child_list =3D root2->get_children("child"); Node *node_to_add =3D child_list.front(); // import the node under the root element (recursive is default) root1->import_node(node_to_add); // print out the new doc1 string doc1_string =3D doc1->write_to_string_formatted(); cout << doc1_string; return EXIT_SUCCESS; } catch (std::exception &e){ cerr << "Caught exception " << e.what() << endl; return EXIT_FAILURE; } } i get the following errors: make all-recursive make[1]: Entering directory `/root/test' Making all in test make[2]: Entering directory `/root/test/test' c++ -DHAVE_CONFIG_H -I. -I. -I.. -O2 -O0 -g3 -Wall -fno-exceptions=20 -fno-check-new -c main.cpp main.cpp: In function `int main(int, char **)': main.cpp:32: exception handling disabled, use -fexceptions to enable main.cpp:47: no matching function for call to `xmlpp::Element::import_nod= e=20 (xmlpp::Node *&)' main.cpp:50: no matching function for call to=20 `xmlpp::Document::write_to_string_formatted ()' make[2]: *** [main.o] Error 1 make[2]: Leaving directory `/root/test/test' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/test' make: *** [all-recursive-am] Error 2 *** failed *** i am pretty sure it's all installed properly because if i try and compile= =20 with just #include <libxml++/libxml++.h> and nothing in the int main() it= =20 doesn't complain that it can't find libxml++.h. I have also tried the=20 examples on Mandrake 9.1 and get i get the same errors. I have tried the=20 other examples and they all fail too. What on earth am i doing wrong?? Tim P.S Let me know if i haven't given enough information or didn't explain mysel= f to=20 well ;-) |