有关在 htmlcxx 中查找'strings.h'的错误
Error about finding 'strings.h' in htmlcxx
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <sstream>
#include <string>
#include <ParserDom.h>
using namespace std;
using namespace htmlcxx;
int main()
{
ifstream bucky;
string str="";
bucky.open("C:\tasks\TEST2.txt");
if(!bucky.is_open()){
exit(EXIT_FAILURE);
}
char word[50];
bucky >> word;
str.append(word);
str.append(" ");
while(bucky.good())
{
bucky >> word;
str.append(word);
str.append(" ");
}
//cout<< word<<" "<<endl;
bucky >> word;
str.append(word);
str.append(" ");
HTML::ParserDom parser;
tree<HTML::Node> dom = parser.parseTree(str);
//Print whole DOM tree
cout << dom << endl;
}
嗨,我正在使用htmlcxx,我安装了它,包括它的头文件和库到我的项目,并写了我的代码如上所述简而言之,我打开一个html文件,将其放入字符串中,然后使用html解析器进行编写。但是我得到了以下错误:
c:...htmlcxx-0.84htmlparsersax.tcc(4): fatal error C1083: Cannot open include file: 'strings.h': No such file or directory
我想知道您是否可以帮我解决这个问题。**
我认为strings.h
是一个unix头文件。基本上,字符串库有两个不同的头:string.h
和strings.h
。它们定义的原型略有不同。应该有一种适当的方法来使用宏来包含适当的宏来测试编译环境。就像
#ifdef _WIN32
#include <string.h>
#else
#include <strings.h>
#endif
我不知道哪个是Windows的标准,这只是一个例子。如果您使用的是第三方代码,则可能无法移植。你应该看看他们的头文件,看看他们是否使用了像上面这样的代码。
编辑:尝试这个快速而丑陋的修复:创建一个包含以下内容的文件strings.h
:
extern "C" {
#include <string.h>
}
这可能有效,取决于它们使用的函数…
编辑:他们在ParserSax.tcc中使用这种宏:
#if !defined(WIN32) || defined(__MINGW32__)
#include <strings.h>
#endif
所以这可能是您的mingw安装的问题。请尝试在您的系统中手动查找此文件
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 在某些循环内使用vector.push_back时出现分段错误
- MSVC多行宏编译器错误
- 我遇到了黑客排名中的问题"TWO STRINGS"的三个测试用例的分段错误。原因是什么?
- 将错误作为从字符串常量到"char*"的已弃用转换 [-Wwrite-strings]
- 有关在 htmlcxx 中查找'strings.h'的错误