[PyQt] Problem with sip.h redefining the 'ANY' symbol

Phil Thompson phil at riverbankcomputing.com
Tue Feb 22 15:41:55 GMT 2011


On Thu, 17 Feb 2011 12:36:25 -0800, Nate Reid <gnatty7 at hotmail.com> wrote:
> In some bindings I'm working with, one of the header files that is
> included after sip.h has an enum who one of its values is called 'ANY'. 
> However, when sip is run, it includes its headers first and then
redefines
> ANY before the wrapped source defines it in the enum, causing a
compilation
> error.
> Why does SIP need to do this, and if so, is there a workaround that
> doesn't involve editing the underlying C++ headers that are being
included.
> Consider them from a non-modifyable third party library.
> 
> siplib/sip.h
> 189:#if !defined(ANY)
> 190:#define ANY     void

It's there to provide compatibility for handwritten code that might also
be used with sip v3 and old versions of Python.

I think you can work round it by placing...

%ModuleHeaderCode
#undef ANY
%End

...in one of your .sip files.

Phil


More information about the PyQt mailing list