Trouble with compilers to create mex files

I am using a trial version of Matlab 2016a and the compiler is MinGW64 Compiler (C++). The OpenCV libraries are built by using Microsoft Visual C++ 2012.The compilers are not compatible. I could not build the .mexw64 file. Don't want to change codes. Is there any command line or something ?
After writing command "mexOpenCV -v COMPFLAGS="$COMPFLAGS -Wall" backgroundSubtractorOCV.cpp"
I had the following error lines
Error using mexOpenCV (line 122)
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x19a):
undefined reference to `cv::BackgroundSubtractorMOG2::BackgroundSubtractorMOG2(int, float, bool)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x2d5):
undefined reference to `ocvMxArrayToImage_uint8(mxArray_tag const*, bool)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x2f0):
undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x2fd):
undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x31f):
undefined reference to `ocvMxArrayFromImage_bool(cv::Mat const&)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x365):
undefined reference to `cv::Mat::deallocate()'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x3a9):
undefined reference to `cv::fastFree(void*)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x3ba):
undefined reference to `cv::fastFree(void*)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x3da):
undefined reference to `cv::Mat::deallocate()'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x42a):
undefined reference to `cv::fastFree(void*)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x44a):
undefined reference to `cv::Mat::deallocate()'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text+0x48e):
undefined reference to `cv::fastFree(void*)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text$_ZN2cv3MatD1Ev[_ZN2cv3MatD1Ev]+0x29):
undefined reference to `cv::Mat::deallocate()'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text$_ZN2cv3MatD1Ev[_ZN2cv3MatD1Ev]+0x6d):
undefined reference to `cv::fastFree(void*)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text$_ZN2cv3PtrINS_3MatEE7releaseEv[_ZN2cv3PtrINS_3MatEE7releaseEv]+0x4b):
undefined reference to `cv::Mat::deallocate()'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text$_ZN2cv3PtrINS_3MatEE7releaseEv[_ZN2cv3PtrINS_3MatEE7releaseEv]+0x8f):
undefined reference to `cv::fastFree(void*)'
C:\Users\MASTRA~1\AppData\Local\Temp\mex_52372207500085_228\backgroundSubtractorOCV.obj:backgroundSubtractorOCV.cpp:(.text$_ZN2cv3PtrINS_3MatEE7releaseEv[_ZN2cv3PtrINS_3MatEE7releaseEv]+0xa0):
undefined reference to `cv::fastFree(void*)'
collect2.exe: error: ld returned 1 exit status

1 Comment

Was a solution to this issue ever found? I am currently experiencing the same problem.

Sign in to comment.

Answers (0)

Products

Asked:

on 24 May 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!