我没有C/C++语法的经验,我面临着调整这种语法变化的问题。我正在尝试为libvisio2生成mex文件。我有2017和Matlab2018a。
完全错误是
D:\Libraries\libviso2\matlab\matcherMex.cpp(101): error C2440: 'initializing': cannot convert from 'const mwSize *' to
'const int32_t *'
D:\Libraries\libviso2\matlab\matcherMex.cpp(101): note: Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast其中,文件matcherMex.cpp中的行是:
99: // get pointer to left image
100: uint8_t* I1 = (uint8_t*)mxGetPr(prhs[1]);
101: const int32_t *dims1 = mxGetDimensions(prhs[1]);
102:
103: // transpose
104: uint8_t* I1_ = transpose<uint8_t>(I1,dims1);
105: int32_t dims1_[] = {dims1[1],dims1[0],dims1[1]};任何帮助都将不胜感激,谢谢
发布于 2018-11-17 14:48:25
编译时,需要将-compatibleArrayDims传递给mex函数。
默认情况下,MEX-文件是以64位整数存储数组索引和大小的模式编译的( MATLAB就是这样本地存储它们的)。回到过去,想必当您的代码被编写时,它们是32位整数。给定的编译器标志将使MATLAB自动为您转换这些变量的类型(如果数组大小太大,无法适应32位整数,则希望抛出一个错误)。
https://stackoverflow.com/questions/53350219
复制相似问题