RochaPinto
08-15-2012, 05:22 PM
Your Example 2 (http://www.nr.com/nr3_python_tutorial.html) should be used for casting C++ vectors, matrices and lists in Python and vice-versa. However, it is not working properly and from the error message it seems some classes in nr3python.h are not completely defined.
When I attempt to build Example 2, I got this:
example2.cpp: In function ?PyObject* func(PyObject*, PyObject*)?:
example2.cpp:28:41: error: no matching function for call to ?NRpyInt(NRpyList)?
example2.cpp:28:41: note: candidates are:
nr3python.h:85:5: note: int NRpyInt(PyObject*)
nr3python.h:85:5: note: no known conversion for argument 1 from ?NRpyList? to ?PyObject* {aka _object*}?
nr3python.h:91:5: note: int NRpyInt(char*, char*)
nr3python.h:91:5: note: no known conversion for argument 1 from ?NRpyList? to ?char*?
nr3python.h:150:5: note: int NRpyInt(NRpyList&)
nr3python.h:150:5: note: no known conversion for argument 1 from ?NRpyList? to ?NRpyList&?
In file included from example2.cpp:1:0:
nr3python.h: In function ?PyObject* NRpyObject(NRvector<T>&) [com T = double, PyObject = _object]?:
example2.cpp:51:23: instantiated from here
nr3python.h:850:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
nr3python.h:852:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
nr3python.h: In function ?PyObject* NRpyObject(NRmatrix<T>&) [com T = double, PyObject = _object]?:
example2.cpp:52:23: instantiated from here
nr3python.h:865:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
nr3python.h:867:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
It seems a new nr3python.h with the right definitions for NRpyInt and NRpyObject should be provided. Do you confirm this?
When I attempt to build Example 2, I got this:
example2.cpp: In function ?PyObject* func(PyObject*, PyObject*)?:
example2.cpp:28:41: error: no matching function for call to ?NRpyInt(NRpyList)?
example2.cpp:28:41: note: candidates are:
nr3python.h:85:5: note: int NRpyInt(PyObject*)
nr3python.h:85:5: note: no known conversion for argument 1 from ?NRpyList? to ?PyObject* {aka _object*}?
nr3python.h:91:5: note: int NRpyInt(char*, char*)
nr3python.h:91:5: note: no known conversion for argument 1 from ?NRpyList? to ?char*?
nr3python.h:150:5: note: int NRpyInt(NRpyList&)
nr3python.h:150:5: note: no known conversion for argument 1 from ?NRpyList? to ?NRpyList&?
In file included from example2.cpp:1:0:
nr3python.h: In function ?PyObject* NRpyObject(NRvector<T>&) [com T = double, PyObject = _object]?:
example2.cpp:51:23: instantiated from here
nr3python.h:850:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
nr3python.h:852:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
nr3python.h: In function ?PyObject* NRpyObject(NRmatrix<T>&) [com T = double, PyObject = _object]?:
example2.cpp:52:23: instantiated from here
nr3python.h:865:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
nr3python.h:867:3: error: cannot convert ?npy_int* {aka int*}? to ?npy_intp* {aka long int*}? in argument passing
It seems a new nr3python.h with the right definitions for NRpyInt and NRpyObject should be provided. Do you confirm this?