[Pyrex] char specifier in enum

Simon Burton simon at arrowtheory.com
Fri Feb 22 18:15:00 CET 2008


I have a simple example:

cdef enum foo:
    A = 'A'
    B = 'B'


gcc (4.0.3) gives this error:

test.c:46: error: ‘__pyx_k1’ undeclared here (not in a function)
test.c:48: error: ‘__pyx_k2’ undeclared here (not in a function)

here are the offending lines:

 42
 43 /* Declarations from test */
 44
 45 enum __pyx_t_4test_foo {
 46   __pyx_e_4test_A = __pyx_k1,
 47   __pyx_e_4test_B = __pyx_k2
 48 };
 49
 50
 51
 52 /* Implementation of test */
 53
 54 static char __pyx_k1[] = "A";
 55 static char __pyx_k2[] = "B";
 56

There are several problems with this code...

I am basically translating some c code to pyrex, maybe i should just put this enum stuff
in a header and use a cdef extern in my pyrex code.

Any other ideas ?

thanks,

Simon.




More information about the Pyrex mailing list