0

我想在 Windows 7 中编译这段代码:(这个

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

所以,我认为我没有正确链接我的库;我进入->项目->构建选项->编译器设置->其他选项:我添加了=>

  • 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/包括
  • IC:/gdkdir/include/freetype2

为此,我下载了库 => libxml2 和 glibmm2.4 并将它们包括在内。

它仍然给我同样的错误!

请帮我。

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

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

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

4

0 回答 0