[Numpy-discussion] NPY_DOUBLE not declared

Sturla Molden sturla.molden at gmail.com
Mon Aug 17 09:05:42 EDT 2015


Why not do as it says instead?


#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION

/* Or: NPY_NO_DEPRECATED_API NPY_API_VERSION */

#include <Python.h>
#include <numpy/arrayobject.h>



Sturla


On 17/08/15 13:11, Florian Lindner wrote:
> Hello,
>
> I try to converse a piece of C code to the new NumPy API to get rid of the
> deprecation warning.
>
> #warning "Using deprecated NumPy API, disable it by " "#defining
> NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
>
> As a first step I replaced arrayobject.h by numpy/npy_math.h:
>
> #include <Python.h>
> #include <numpy/npy_math.h>
>
> But this gives errors that NPY_DOUBLE is not declared.
>
> http://docs.scipy.org/doc/numpy/reference/c-api.dtype.html#c.NPY_DOUBLE
> gives no information where NPY_DOUBLE is declared, so I used the standard
> npy_math.h header.
>
> src/action/PythonAction.cpp:90:51: error: 'NPY_DOUBLE' was not declared in
> this scope
>             PyArray_SimpleNewFromData(1, sourceDim, NPY_DOUBLE,
> sourceValues);
>
>
> Including numpy/npy_common.h does not change it either.
>
> Thanks,
> Florian
>





More information about the NumPy-Discussion mailing list