passing argument 2 of 'mxCreateNumericArray' from incompatible pointer type
25 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
James Tursa
on 25 Apr 2013
Edited: James Tursa
on 25 Apr 2013
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 Comments
More Answers (1)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!