conversion problem with template, const with gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Roy Yves
yves.roy@umontreal.ca
Mon Jun 14 20:04:00 GMT 2004
Hi:
I am really puzzled with errors like the following:
g++ -c pymat.cpp -o pymat.o -I/usr/local/matlab6p5/extern/include -I/usr/include/python2.2/numarray -I/usr/include/python2.2
pymat.cpp: In function `mxArray* makeMxFromNumeric(const PyArrayObject*)':
pymat.cpp:216: invalid conversion from `const maybelong*' to `int*'
pymat.cpp:216: initializing argument 5 of `void copyNumeric2Mx(T*, int, int,
double*, int*) [with T = char]'
where copyNumeric2Mx is a template function:
template <class T>
void copyNumeric2Mx(T *pSrc, int pRows, int pCols, double *pDst, int *pStrides)
{ // ... }
for each instantiated template function like in the following:
case PyArray_CHAR:
copyNumeric2Mx((char *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
break;
case PyArray_UBYTE:
copyNumeric2Mx((unsigned char *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
break;
case PyArray_SBYTE:
copyNumeric2Mx((signed char *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
break;
case PyArray_SHORT:
copyNumeric2Mx((short *)(pSrc->data), lRows, lCols, lR, pSrc->strides);
break;
Anybody can help me?
Thanks
Roy
More information about the Gcc-help
mailing list