如何正确包含libxml ++库?

时间:2014-06-17 09:41:13

标签: c++ linker codeblocks linker-flags

我想在Windows 7中编译此代码:(this

#include <libxml++/libxml++.h>
#include <cstdlib>
#include <iostream>

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;
}

我使用Code :: Blocks,但它给了我错误:

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()'

所以,我认为我没有正确地链接我的图书馆;我进去了 - &gt; project-&gt;构建选项 - &gt;编译器设置 - &gt;其他选项:我添加了=&gt;

  • 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 /包含/开罗
  • IC:/gdkdir/include/pango-1.0
  • IC:/gdkdir/include/gdk-pixbuf-2.0
  • IC:/ gdkdir /包含/ libpng15
  • IC:/ gdkdir /包含/ pixman-1
  • IC:/ gdkdir /包括
  • IC:/ gdkdir /包含/对FreeType2

帮助this我下载了librarys =&gt; libxml2和glibmm2.4和我包括它们。

它仍然给我同样的错误!

请帮帮我。

更新17/06:我还检查了this,但它仍然给我同样的错误!

更新18/06:那就是我所做的:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

0 个答案:

没有答案