cURL / Mailing Lists / curl-library / Single Mail

curl-library

error: 'htmlSAXHandler' does not name a type & error: 'htmlParserCtxtPtr' was not declared in this scope

From: <l.alebarde2_at_free.fr>
Date: Sat, 15 Dec 2007 10:29:41 +0100

Hello,

I am trying the following example, as a curl beginner, and as a non software
professional :
http://curl.haxx.se/lxr/source/docs/examples/postit2.c

I have two errors I don't reach to solve, for which I would like your help.

I am under Linux and I use Eclipse IDE. Here is the compilation command :
Invoking: GCC C++ Compiler
g++ -I/usr/include/libxml2/libxml -I/usr/include/curl -O0 -g3 -Wall -c
-fmessage-length=0 -MMD -MP -MF"curl.d" -MT"curl.d" -o"curl.o" "../curl.cpp"

ERROR 1 (compile time) :
------------------------
I had to add :
#include <libxml2/libxml/xmlstring.h>
to have xmlChar type defined

I have several other errors concerning this include :
  a) line 40 : 'XMLPUBFUN' does not name a type
  b) line 54 : expected constructor, destructor, or type conversion before
'const'
  c) line 63 : expected constructor, destructor, or type conversion before 'int'

and in the example program :
error: 'htmlSAXHandler' does not name a type

Trying to solve the last :
# grep htmlSAXHandler\; /usr/include/libxml2/libxml/*.h | grep typedef
-> /usr/include/libxml2/libxml/HTMLparser.h-typedef xmlSAXHandlerPtr
htmlSAXHandlerPtr;
# grep xmlSAXHandler\; /usr/include/libxml2/libxml/*.h | grep typedef
-> /usr/include/libxml2/libxml/tree.h-typedef struct _xmlSAXHandler
xmlSAXHandler;
# grep _xmlSAXHandler\; /usr/include/libxml2/libxml/*.h | grep typedef
-> I get nothing here (adding libxml2/libxml/tree.h changes nothing).
***********************************************************
******* So where _xmlSAXHandler is defined ? **************
***********************************************************

ERROR 2 (compile time) :
------------------------
../curl.cpp: In function 'void parseHtml(const std::string&, std::string&)':
../curl.cpp:149: error: 'htmlParserCtxtPtr' was not declared in this scope

Trying to solve this :
# grep htmlParserCtxtPtr\; /usr/include/libxml2/libxml/*.h | grep typedef
-> /usr/include/libxml2/libxml/HTMLparser.h:typedef xmlParserCtxtPtr
htmlParserCtxtPtr;
# grep xmlParserCtxtPtr\; /usr/include/libxml2/libxml/*.h | grep typedef
-> /usr/include/libxml2/libxml/tree.h:typedef xmlParserCtxt *xmlParserCtxtPtr;
# grep xmlParserCtxt\; /usr/include/libxml2/libxml/*.h | grep typedef
-> /usr/include/libxml2/libxml/tree.h:typedef struct _xmlParserCtxt
xmlParserCtxt;
# grep _xmlParserCtxt\; /usr/include/libxml2/libxml/*.h | grep typedef
-> I get nothing here (adding libxml2/libxml/tree.h changes nothing).
***********************************************************
******* So where _xmlParserCtxt is defined ? **************
***********************************************************

Best regards,

Laurent.
Received on 2007-12-15