passing argument 2 of 'mxCreateNumericArray' from incompatible pointer type
24 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to develop a software and when I compile I have the following warning:
sin_reg.c:72:2: attention : passing argument 2 of 'mxCreateNumericArray' from incompatible pointer type [enabled by default]
In file included from /usr/local/R2011b/extern/include/mex.h:58:0,
from nmsimplex.h:33,
from sin_reg.c:2:
/usr/local/R2011b/extern/include/matrix.h:891:19: note: expected 'const mwSize *' but argument is of type 'int *'
The code is the following:
mwSize volume_dims2[3];
volume_dims2[0] = n_y;
volume_dims2[1] = 0;
volume_dims2[2] = n_x;
volume_dims2[3] = 0;
volume_dims2[4] = (mwSize) 2;
volume_dims2[5] = 0;
plhs[0] = mxCreateNumericArray((mwSize) 3, volume_dims2, mxDOUBLE_CLASS, mxREAL);
What is wrong?
Thank you for your help, Cédric
0 个评论
采纳的回答
James Tursa
2013-4-25
编辑:James Tursa
2013-4-25
Maybe you have inadvertantly redefined mwSize. Do you have the following statement somewhere at the top of your code?
#define mwSize int
This could have been used to support earlier versions of MATLAB that do not have a typedef for mwSize, for example. If so, you can get rid of it or wrap it as follows:
#ifndef MWSIZE_MAX
#define mwSize int
#endif
Also, you have only declared volume_dims2 to have 3 elements, but you are stuffing values into 6 elements ... writing beyond the array bounds which will probably result in a crash. And additionally, it looks rather weird that you are stuffing 0 into some of the elements ... is that what you really intended?
0 个评论
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!