Fwd: [Numpy-discussion] Numpy does not compile with PY_ARRAY_TYPES_PREFIX

Sasha ndarray at mac.com
Fri Jan 27 14:51:03 CST 2006


On 1/27/06, David M. Cooke <cookedm at physics.mcmaster.ca> wrote:
> You need to add #include "Python.h" as the first include (and add a
> -I<python include directory> to your gcc line, of course).

Still does not work

> cat test.c
#define PY_ARRAY_TYPES_PREFIX XYZ_
#include <Python.h>
#include <numpy/arrayobject.h>

> gcc -I Python-2.4.1/include/python2.4 -I lib/python2.4/site-packages/numpy/core/include -c test.c
In file included from
lib/python2.4/site-packages/numpy/core/include/numpy/arrayobject.h:1346,
                 from test.c:3:
lib/python2.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:
In function `import_array':
lib/python2.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:765:
parse error before ')' token
lib/python2.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:765:
parse error before ')' token
lib/python2.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:
At top level:
lib/python2.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:771:
parse error before "return"


If I remove #define PY_ARRAY_TYPES_PREFIX or define it as nothing,
compilation works.

The RPy.h header I was trying to compile in the first plase includes
numpy/arrayobject.h after
Python.h .




More information about the Numpy-discussion mailing list