[PyQt] SIP: name collision for ANY

Phil Thompson phil at riverbankcomputing.com
Mon Apr 19 22:35:52 BST 2010


On Mon, 19 Apr 2010 17:25:47 -0400, Josh Knox <jknox at irobot.com> wrote:
> sip.h has a "#define ANY void".
> 
> I'm trying to build a binding for an OpenSceneGraph Qt widget. In some 
> OSG header they use "ANY" as an element in an enum.
> 
> When trying to build the binding, which includes the header with the ANY 
> enum it dies with:
> 
> error: expected identifier before ‘void’
> 
> 
> This is easily reproduced by using the word "ANY" in any non comment C++ 
> code used in a binding.
> 
> I made the following patch in my sandbox to get around the issue, so 
> that ANY is only defined for SIP v3:
> 
> 
> %> diff -u sip.h sip.h.new
> --- sip.h 2010-04-19 17:22:20.000000000 -0400
> +++ sip.h.new 2010-04-19 17:22:10.000000000 -0400
> @@ -171,9 +171,11 @@
> 
> 
> /* Some compatibility stuff to help with handwritten code for SIP v3. */
> +#if SIP_API_MAJOR_NR == 3
> #if !defined(ANY)
> #define ANY void
> #endif
> +#endif
> 
> 
> Is that a valid work-around for this issue?

No, SIP_API_MAJOR_NR has nothing to with the version number of the sip
package.

If you are happy to hack at sip.h then just remove the #define. It's
probably only used by PyQt3.

Phil


More information about the PyQt mailing list