[PyQt] SIP: name collision for ANY

Josh Knox jknox at irobot.com
Mon Apr 19 22:25:47 BST 2010

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

Is that a valid work-around for this issue?



More information about the PyQt mailing list