VL_feat Matlab GCC 无法编译
VL_feat Matlab GCC can't compile
我试图按照此处的说明在 matlab 中编译函数 c_eoverlap
:
http://www.robots.ox.ac.uk/~vgg/research/affine/evaluation.html#eval_soft
当然,它不会成功...我的 Matlab 版本是 2018a,这是很新的,gcc -v
输出以下内容
另外附上这个长错误日志,因为我是 C++ 的新手,如果需要任何其他信息,请告诉我,感谢您的帮助!
>> mex repeatability/c_eoverlap.cxx
Building with 'Xcode Clang++'.
Error using mex
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:34:14: error: cannot initialize
a variable of type 'const int *' with an rvalue of type 'const mwSize *' (aka 'const unsigned
long *')
int const *dims1 = mxGetDimensions(prhs[0]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:36:14: error: cannot initialize
a variable of type 'const int *' with an rvalue of type 'const mwSize *' (aka 'const unsigned
long *')
int const *dims2 = mxGetDimensions(prhs[1]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:38:14: error: cannot initialize
a variable of type 'const int *' with an rvalue of type 'const mwSize *' (aka 'const unsigned
long *')
int const *dims3 = mxGetDimensions(prhs[2]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:46:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[0] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:47:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[1] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:48:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[2] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:49:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[3] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:198:3: warning: 'delete[]'
applied to a pointer that was allocated with 'new'; did you mean 'delete'?
[-Wmismatched-new-delete]
delete []tdesc_out;
^ ~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:62:22: note: allocated with
'new' here
float *tdesc_out = new float[dims2[1]*dims1[1]];
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:199:3: warning: 'delete[]'
applied to a pointer that was allocated with 'new'; did you mean 'delete'?
[-Wmismatched-new-delete]
delete []tover_out;
^ ~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:63:22: note: allocated with
'new' here
float *tover_out = new float[dims2[1]*dims1[1]];
^
2 warnings and 7 errors generated.
您需要将 -compatibleArrayDims
添加到您的 mex
命令中:
mex -compatibleArrayDims c_eoverlap.cxx
该代码是为使用 32 位整数 (int
) 作为数组大小的旧版 MATLAB 编写的。现在这些是 64 位 (mwSize
)。该选项强制接口像在旧版 MATLAB 中那样工作。有关详细信息,请参阅 the mex
documentation。
关于使用 delete[]
而不是 delete
有一些可怕的警告。这只是警告,因此它会编译,但您不知道代码是否会执行预期的操作。
我试图按照此处的说明在 matlab 中编译函数 c_eoverlap
:
http://www.robots.ox.ac.uk/~vgg/research/affine/evaluation.html#eval_soft
当然,它不会成功...我的 Matlab 版本是 2018a,这是很新的,gcc -v
输出以下内容
另外附上这个长错误日志,因为我是 C++ 的新手,如果需要任何其他信息,请告诉我,感谢您的帮助!
>> mex repeatability/c_eoverlap.cxx
Building with 'Xcode Clang++'.
Error using mex
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:34:14: error: cannot initialize
a variable of type 'const int *' with an rvalue of type 'const mwSize *' (aka 'const unsigned
long *')
int const *dims1 = mxGetDimensions(prhs[0]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:36:14: error: cannot initialize
a variable of type 'const int *' with an rvalue of type 'const mwSize *' (aka 'const unsigned
long *')
int const *dims2 = mxGetDimensions(prhs[1]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:38:14: error: cannot initialize
a variable of type 'const int *' with an rvalue of type 'const mwSize *' (aka 'const unsigned
long *')
int const *dims3 = mxGetDimensions(prhs[2]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:46:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[0] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:47:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[1] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:48:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[2] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:49:13: error: no matching
function for call to 'mxCreateNumericArray_730'
plhs[3] = mxCreateNumericArray(2, odim, mxDOUBLE_CLASS, mxREAL);
^~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^~~~~~~~~~~~~~~~~~~~~~~~
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:1256:1: note: candidate function not
viable: no known conversion from 'int *' to 'const mwSize *' (aka 'const unsigned long *')
for 2nd argument
mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
^
/Applications/MATLAB_R2018a.app/extern/include/matrix.h:282:30: note: expanded from macro
'mxCreateNumericArray'
#define mxCreateNumericArray mxCreateNumericArray_730
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:198:3: warning: 'delete[]'
applied to a pointer that was allocated with 'new'; did you mean 'delete'?
[-Wmismatched-new-delete]
delete []tdesc_out;
^ ~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:62:22: note: allocated with
'new' here
float *tdesc_out = new float[dims2[1]*dims1[1]];
^
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:199:3: warning: 'delete[]'
applied to a pointer that was allocated with 'new'; did you mean 'delete'?
[-Wmismatched-new-delete]
delete []tover_out;
^ ~~~
/Users/lucius/Desktop/ua/805/a1/repeatability/c_eoverlap.cxx:63:22: note: allocated with
'new' here
float *tover_out = new float[dims2[1]*dims1[1]];
^
2 warnings and 7 errors generated.
您需要将 -compatibleArrayDims
添加到您的 mex
命令中:
mex -compatibleArrayDims c_eoverlap.cxx
该代码是为使用 32 位整数 (int
) 作为数组大小的旧版 MATLAB 编写的。现在这些是 64 位 (mwSize
)。该选项强制接口像在旧版 MATLAB 中那样工作。有关详细信息,请参阅 the mex
documentation。
关于使用 delete[]
而不是 delete
有一些可怕的警告。这只是警告,因此它会编译,但您不知道代码是否会执行预期的操作。