passing argument 2 of 'mxCreateNumericArray' from incompatible pointer type
조회 수: 8 (최근 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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!