kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
659 stars 318 forks source link

mexopencv.make error:Unsupported compiler (matlab2015b and VS2015 professtional) #431

Closed chunniunai220ml closed 5 years ago

chunniunai220ml commented 5 years ago

Hello I'm using : Windows 7 Professional x64 Matlab R2015b 64 bits Visual Studio professional 2015 Win64 OpenCV 2.4.13.3

There is a error confused me somedays,and I can not figure it out with some other advices in google. mex -setup c++ is ok, image

BUT when commands mexopencv.make(): image

I have checked Previous Releases: Supported and Compatible Compilers – Release 2015b, image

I choose typical installation with VS2015,and I have no idea if the professional VS2015 professional need some special config.

amroamroamro commented 5 years ago

The v2.4 branch of mexopencv hasn't been updated since we moved to OpenCV 3.x as the current version.

The error you're getting is because the make.m script doesn't handle VS2015 or VS2017 compilers (they weren't released at the time):

https://github.com/kyamagu/mexopencv/blob/555395815d208c4f1057a2a1a9a68a3966a60bff/%2Bmexopencv/make.m#L245-L253

As a quick fix, you could manually edit the file adding the following lines:

        if strcmp(cc.Manufacturer, 'Microsoft')
            if ~isempty(strfind(cc.Name, 'Visual'))  % Visual Studio
                switch cc.Version
+                   case '15.0'
+                       s = 'vc15';    % VS2017
+                   case '14.0'
+                       s = 'vc14';    % VS2015
                    case '12.0'
                        s = 'vc12';    % VS2013
                    case '11.0'
                        s = 'vc11';    % VS2012

Also note that the v2.4 branch was last tested against opencv 2.4.11, so you might encounter some hiccups against the newer opencv 2.4.13.3 you're using, I'm not sure..

amroamroamro commented 5 years ago

If you don't have a specific requirement to depend on opencv 2.4, I recommend you update and move to opencv 3.

chunniunai220ml commented 5 years ago

@amroamroamro THX so much! The quick fix works well, and I will take your recommendation to avoid other errors.