Reputation: 21
#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;
}
Hi, I am using htmlcxx , I installed it, included its header files and libraries to my projects, and wrote my code as above In brief, I opened a html file , put it in string, and then used html parser to write it. but I got the following error:
c:\...\htmlcxx-0.84\html\parsersax.tcc(4): fatal error C1083: Cannot open include file: 'strings.h': No such file or directory
I wonder if you could please help me to solve this problem.**
Upvotes: 2
Views: 9868
Reputation: 2420
I think strings.h
is a unix header file. Basically there are two different headers for the string library: string.h
and strings.h
. Those define slightly different prototypes. There should be a proper way to include the appropriate one using macros to test your compilation environment. Something like
#ifdef _WIN32
#include <string.h>
#else
#include <strings.h>
#endif
I don't know which one is standard on Windows, this is just an example. If you are using third party code, it might not be portable. You should have a look at their headers and see if they are using code like the one above.
Edit:
try this quick and ugly fix: create a file strings.h
which constains:
extern "C" {
#include <string.h>
}
That might work, depending on which functions they use...
Edit:
They do use this kind of macros in ParserSax.tcc:
#if !defined(WIN32) || defined(__MINGW32__)
#include <strings.h>
#endif
So it might be a problem with your mingw installation. Try to find this file manually on your system.
Upvotes: 2