- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用htmlcxx
来解析网页。问题是,这个例子是不可编译的。
我在运行 g++ webscrsp.cpp
时得到这个:
/tmp/ccHiUM6o.o: In function `main':webscrsp.cpp:(.text+0x86): undefined reference to `htmlcxx::HTML::ParserSax::parse(std::basic_string, std::allocator > const&)'webscrsp.cpp:(.text+0xb8): undefined reference to `htmlcxx::HTML::operator >&, tree > > const&)'/tmp/ccHiUM6o.o: In function `htmlcxx::HTML::ParserDom::ParserDom()':webscrsp.cpp:(.text._ZN7htmlcxx4HTML9ParserDomC1Ev[htmlcxx::HTML::ParserDom::ParserDom()]+0x22): undefined reference to `vtable for htmlcxx::HTML::ParserDom'/tmp/ccHiUM6o.o: In function `htmlcxx::HTML::ParserDom::~ParserDom()':webscrsp.cpp:(.text._ZN7htmlcxx4HTML9ParserDomD1Ev[htmlcxx::HTML::ParserDom::~ParserDom()]+0x16): undefined reference to `vtable for htmlcxx::HTML::ParserDom'collect2: ld returned 1 exit status
my code is
#include <string>
#include <iostream>
#include <sstream>
#include </home/lubhavan/htmlcxx-0.84/html/ParserDom.h>
using namespace std;
using namespace htmlcxx;
int main()
{
string html ="<html > <head> <title > hi iam titile </title> </head> <body> <p> what can i do </p> </body> </html>";
HTML::ParserDom parser;
tree<HTML::Node> dom = parser.parseTree(html) ;
cout << dom <<endl;
cout << endl;
return 0;
}
请帮助我,因为我必须尽快完成。我无法得到错误...
提前致谢..
最佳答案
如果你的整个命令行是
g++ webscrsp.cpp
然后你会得到链接器错误,因为你没有链接到包含实际代码的库。
你必须做这样的事情:
g++ webscrsp.cpp -L/path/to/library -Wl,-rpath=/path/to/library -lname_of_library
在上面的命令行示例中,/path/to/library
是名为libXXX.a
的文件的路径,其中XXX
是 name_of_library
。
在您的情况下,您应该在 /home/lubhavan/htmlcxx-0.84/
的某处查找以 lib
开头并以 结尾的文件。一个
。 /path/to/library
是该文件所在的路径。 name_of_library
是没有前导 lib
和尾随 .a
的文件名。
关于c++ - htmlcxx0.84编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9476580/
我尝试使用 htmlcxx 来解析网页。问题是,这个例子不是可编译的 atm。 tree::iterator it = dom.begin(); tree::iterator end = dom.en
包括 #include #include #include #include #include using namespace std; using namespace ht
我从不同的人那里读到了许多关于库抓取 HTML 的不同问题。我决定使用 htmlcxx,因为它看起来很简单,而且它在 Ubuntu 存储库中。无论如何,在玩 htmlcxx 时,我试图完成一个简单的任
我正在使用 htmlcxx library读取 HTML 文件并生成具有附加内容的相同 HTML 文件。 我可以毫无问题地读取文件,但简单地发出原始 HTML 文件并不能正确包含结束标记。也就是说,当
如何显示显示文本和标签及其属性的 html 树。我会很感激 htmlcxx 的任何体面的手册或文档,我找不到任何帮助自己的东西。 最佳答案 我认为您的问题与其他 SO 线程非常相似。所提供的答案应该可
#include #include #include #include #include #include using namespace std; using namespace htm
我正在为一个简单的程序使用 htmlcxx 库,但我遇到了一个问题,我搜索了许多其他相关的解决方案,但我的问题仍然是一个问题,希望有人能帮助我,这是我在 Kdevelop 上使用的代码Ubuntu:
我是一名优秀的程序员,十分优秀!