Thursday, May 24, 2018

c++ - How to include libxml++ library, correctly?

I would like to compile this code in windows 7: (this)




#include 
#include
#include

using namespace std;
int main(){
xmlpp::DomParser doc;
// 'response' contains your HTML
doc.parse_memory(CleanHTML(html));


xmlpp::Document* document = doc.get_document();
xmlpp::Element* root = document->get_root_node();

xmlpp::NodeSet elemns = root->find("descendant-or-self::*[@id = 'some_id']");
std::cout << elemns[0]->get_line() << std::endl;
std::cout << elemns.size() << std::endl;

return 0;
}



I'm using Code::Blocks, but it gives me errors:



undefined reference to `xmlpp::DomParser::DomParser()'
undefined reference to `Glib::ustring::ustring(std::string const&)'
undefined reference to `xmlpp::DomParser::parse_memory(Glib::ustring const&)'
undefined reference to `Glib::ustring::~ustring()'
undefined reference to `xmlpp::DomParser::get_document()'
undefined reference to `xmlpp::Document::get_root_node() const'

undefined reference to `Glib::ustring::ustring(char const*)'
undefined reference to `xmlpp::Node::find(Glib::ustring const&) const'
undefined reference to `Glib::ustring::~ustring()'
undefined reference to `xmlpp::Node::get_line() const'
undefined reference to `xmlpp::DomParser::~DomParser()'
undefined reference to `Glib::ustring::~ustring()'
undefined reference to `Glib::ustring::~ustring()'
undefined reference to `xmlpp::DomParser::~DomParser()'



So, I thought that I did not linked my librarys correctly; I go in ->project->build options->compiler settings->other options : and I added =>




  • IC:/gdkdir/include/glib-2.0

  • IC:/gdkdir/lib/glib-2.0/include

  • IC:/gdkdir/lib -lglib-2.0 -lintl

  • IC:/gdkdir/include/gtk-3.0

  • IC:/gdkdir/include/cairo

  • IC:/gdkdir/include/pango-1.0

  • IC:/gdkdir/include/gdk-pixbuf-2.0


  • IC:/gdkdir/include/libpng15

  • IC:/gdkdir/include/pixman-1

  • IC:/gdkdir/include

  • IC:/gdkdir/include/freetype2



Helped with this I downloaded the librarys => libxml2 and glibmm2.4 and I included them.



And it still gives me the same errors!




Please help me.



UPDATE 17/06 : I also checked this but it still gives me the same errors!



UPDATE 18/06 : That's what I did:



enter image description here



enter image description here




enter image description here



enter image description here



enter image description here

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...