[Expat-discuss] cannot convert parameter from 'void (void *, const char *, const char ** )'

Karl Waclawek karl at waclawek.net
Tue Mar 30 16:06:47 EST 2004


> I am having problems compiling my C++ class using expat. I am
> running on Windows 2000, using VC++ 6.0 (MS Visual Studio).
> I have the correct library and include file. I have compiled the
> example on this platform and also created a multi-threaded example which 
> work fine. The examples didn't use classes.
> 
<snip>

>   void XMLCALL  
>  _exp_startTagHandler(void *userData, const char *name, const char **atts);
    
    
>  void XMLCALL CNode::_exp_startTagHandler(void *userData, const char
>    *name, const char **atts)

Is this an instance method (instead of a static method or global function)?
You cannot pass instance methods as call-backs.

>
> c:\surfacehums 1.0\code\shums_node\node.cpp(1381) : error C2664:
> 'XML_SetElementHandler' : cannot convert parameter 2 from 'void (void
> *,const char *,const char ** )' to 'void (__cdecl *)(void *,const char
> *,const char ** )'
>         None of the functions with this name in scope match the target type
> 

The error message would indicate that your XMLCALL is not equal to __cdecl.
(It is defined in expat.h).
Try declaring your call-backs explicitly with __cdecl
and see what happens.

Karl



More information about the Expat-discuss mailing list