libelas: matlab wrapper 编译出问题

寇夜洛
2023-12-01

make
Building wrappers ...
Building with 'g++'.
Error using mex
/home/fupeng/workspace/libelas-master/matlab/elasMex.cpp: In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
/home/fupeng/workspace/libelas-master/matlab/elasMex.cpp:90:50: error: cannot convert ‘const size_t* {aka const long unsigned
int*}’ to ‘const int32_t* {aka const int*}’ in initialization
   const int32_t *I_dims = mxGetDimensions(prhs[0]);
                                                  ^
/home/fupeng/workspace/libelas-master/matlab/elasMex.cpp:98:68: error: cannot convert ‘int32_t* {aka int*}’ to ‘const size_t*
{aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID,
mxComplexity)’
   plhs[0]     = mxCreateNumericArray(2,D_dims,mxSINGLE_CLASS,mxREAL);
                                                                    ^
/home/fupeng/workspace/libelas-master/matlab/elasMex.cpp:100:68: error: cannot convert ‘int32_t* {aka int*}’ to ‘const size_t*
{aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID,
mxComplexity)’
   plhs[1]     = mxCreateNumericArray(2,D_dims,mxSINGLE_CLASS,mxREAL);
                                                                    ^
Error in make (line 25)

mex('elasMex.cpp','../src/elas.cpp','../src/descriptor.cpp', '../src/filter.cpp', ...

 

 

解决方法:添加'-DMX_COMPAT_32',消除32bit系统的影响。

在mex('elasMex.cpp','../src/elas.cpp','../src/descriptor.cpp', '../src/filter.cpp', ...

    '../src/triangle.cpp','../src/matrix.cpp','-I../src','CXXFLAGS=\$CXXFLAGS -msse3 -fPIC','-DMX_COMPAT_32');

 类似资料: