pdollar / toolbox

Piotr's Image & Video Matlab Toolbox
849 stars 500 forks source link

Cannot compile MATLAB 2019a #50

Open violetbrina opened 5 years ago

violetbrina commented 5 years ago

toolboxCompile fails for certain files. It cannot successfully compile due to this error:

Building with 'Xcode Clang++'. -> COMPILE FAILURE: 'gradientMex.cpp' /Users//Library/Application Support/MathWorks/MATLAB Add-Ons/Collections/pdollar_toolbox/pdollar-toolbox-e873326/channels/private/gradientMex.cpp:329:20: error: no matching function for call to 'mxSetDimensions_730' mxSetData(M,*I); mxSetDimensions(M,dims,3); return M; ^~~~~~~ /Applications/MATLAB_R2019a.app/extern/include/matrix.h:248:25: note: expanded from macro 'mxSetDimensions'

define mxSetDimensions mxSetDimensions_730

                    ^~~~~~~~~~~~~~~~~~~

/Applications/MATLAB_R2019a.app/extern/include/matrix.h:1234:1: note: candidate function not viable: no known conversion from 'const int [3]' to 'const mwSize ' (aka 'const unsigned long ') for 2nd argument mxSetDimensions(mxArray pa, const mwSize pdims, mwSize ndims); ^ /Applications/MATLAB_R2019a.app/extern/include/matrix.h:248:25: note: expanded from macro 'mxSetDimensions'

define mxSetDimensions mxSetDimensions_730

                    ^

/Users//Library/Application Support/MathWorks/MATLAB Add-Ons/Collections/pdollar_toolbox/pdollar-toolbox-e873326/channels/private/gradientMex.cpp:339:50: error: assigning to 'const int ' from incompatible type 'const mwSize ' (aka 'const unsigned long *') nDims = mxGetNumberOfDimensions(pr[0]); dims = mxGetDimensions(pr[0]); ^~~~~~ /Applications/MATLAB_R2019a.app/extern/include/matrix.h:244:25: note: expanded from macro 'mxGetDimensions'

define mxGetDimensions mxGetDimensions_730

ardiya commented 5 years ago

@violetbrina I'm compiling octave code, but the error seems similar. So, here's how I fixed mine in Octave https://github.com/ardiya/pdollar_toolbox_octave/commit/b5ec83f0328456fd5b9e2765734d0462db541998.

1069066484 commented 5 years ago

@violetbrina Hi, have you fixed the problem. I have the same problem, too. I did as @ardiya said, but I got a new problem when testing the example codes by invoking imResample. The error said the required memory is too large and the program failed. Any suggestion? I suppose it is because lengths of data types mismatches when performing conversion, but I cannot solve it.

fangfcg commented 4 years ago

solved by https://github.com/laurentkneip/opengv/issues/53#issuecomment-580752262

hpf9017 commented 3 years ago

https://www.mathworks.com/matlabcentral/answers/467491-cpp-to-mex-conversion

solved by laurentkneip/opengv#53 (comment)

can you give more details ? Thanks a lot.