I keep getting this error: #warning "Using deprecated NumPy
API, disable it by #defining NPY_NO_DEPRECATED_API" and a bunch of
undefined variables when comping cython code with numpy

I am new to cython and numpy and I am having trouble getting a *.pyx extension
to compile with this in the header:

from __future__ import division
import numpy as np
cimport numpy as np
DTYPE = np.int
ctypedef np.int_t DTYPE_t

I complie to C code using:
cython -a montcarl.pyx

And it seems to work fine.

I then attempt to compile using:

gcc -I /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/
Python.framework/Versions/2.6/include/python2.6 -I /usr/local/lib/
python2.7/site-packages/numpy/core/include -shared -pthread -fPIC -
fwrapv -O2 -fno-strict-aliasing
-o montcar.so montcarl.c

And I get a bunch of undefined variables:

spoust-m:old spoust$ gcc $CFLAGS -o montcar.so montcarl.c
In file included from /usr/local/lib/python2.7/site-packages/numpy/
core/include/numpy/ndarraytypes.h:1965,
                from /usr/local/lib/python2.7/site-packages/numpy/
core/include/numpy/ndarrayobject.h:17,
                from /usr/local/lib/python2.7/site-packages/numpy/
core/include/numpy/arrayobject.h:14,
                from montcarl.c:225:
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/
npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy
API, disable it by #defining NPY_NO_DEPRECATED_API"
Undefined symbols:
 "_PyLong_AsLong", referenced from:
     ___Pyx_PyInt_AsLong in ccvkIDLQ.o
     ___Pyx_PyInt_AsLong in ccvkIDLQ.o
...

Any ideas on how to get this to compile and how to get rid of these
numpy undefined variables? The cython guys directed me here.

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to