0

I am working on a computer vision project, and I need to use the vlfeat and mexopencv libraries, I am working with MATLAB R2008a and I cannot change the MATLAB compiler to compile and setup the libraries.

I have installed Microsoft Visual C++ Express, but I don't know how to compile the libraries using the Visual C++ compiler in MATLAB.

rayryeng
  • 102,964
  • 22
  • 184
  • 193
Barq
  • 3
  • 1
  • 6
  • What do you mean you can't change the compiler? Did you try `mex -setup`? Also, Visual C++ express should work perfectly fine. I've installed it to make use of Microsoft's C++ compiler. – rayryeng Jan 11 '15 at 17:22
  • Yes, I can not change the compiler so that I can compile and run the libraries functions, I have tried mex -setup ,but It did not show any compiler except lcc and I can not also use it – Barq Jan 11 '15 at 19:18
  • I think I know why it's not working. Please see my answer. – rayryeng Jan 11 '15 at 19:42

1 Answers1

0

The reason why you can't find the compiler is because you are using MATLAB R2008a. The C++ compiler you have downloaded is probably too new for MATLAB to use. My guess is that you are using Express 2013. See the following link on what compilers R2008a can support for MEX here:

http://www.mathworks.com/support/compilers/release2008a/

Specifically, for the Express edition of the Visual C++ compiler, it can only support up to Version 8.0. You are most likely using an Express edition that is newer than 8.0. As such, the only way for you to use the Visual C++ compiler with R2008a is if you download the 8.0 Express edition and install it.

You can find that compiler here: http://go.microsoft.com/fwlink/?LinkId=51410&clcid=0x409

Once you install the Visual C++ compiler, you also need to install the SDK. You can find that here:

http://www.microsoft.com/en-ca/download/details.aspx?id=6510

After you do this, you need to define the MSSdk environment variable. To do this, go to Control Panel -> System then Advanced and Environment Variables. After, create a new variable with the name MSSdk and the value being the path of where you installed the SDK. For example: C:\Program Files\Microsoft Platform SDK for Windows Server 2003.

Good luck!

rayryeng
  • 102,964
  • 22
  • 184
  • 193
  • Thanks for your kind answer and Yes,I am using MS visual c++ 2010 Express,any way I will try to follow your words – Barq Jan 11 '15 at 19:42
  • @Barq - Yes. 2010 is not supported for MATLAB R2008a.... makes sense right? Try downloading that compiler in the link above, install it, and let me know if it works. Good luck! – rayryeng Jan 11 '15 at 19:43
  • I have installed MS v c++2005 from your link and now it is appeared in matlab as a compiler to choose when I have run mex -setup command but It shows that error Error: The Microsoft Platform Software Development Kit (SDK) was not found. Microsoft Visual C++ 2005 Express Edition requires that the SDK is installed properly. MEX uses the environment variable "MSSdk" to find the SDK. If it is installed properly, please erify that the environment variable "MSSdk" points to the correct location. Otherwise, install the SDK and try again. – Barq Jan 12 '15 at 05:15
  • @Barq - Ah! I forgot to mention that you also need the SDK: http://www.microsoft.com/en-us/download/details.aspx?id=8279 - I'll update my post. – rayryeng Jan 12 '15 at 05:18
  • @Barq - Done. There are two more steps you need to do. Let me know if it works! – rayryeng Jan 12 '15 at 05:25
  • Thanks rayryeng it works ,Done :) but I am still facing some problem While running mexopencv.make command ,It shows that error ??? Error using ==> mexopencv.make Error: File: make.m Line: 130 Column: 7 Expression or statement is incorrect--possibly unbalanced (, {, or [ , – Barq Jan 13 '15 at 04:00
  • @Barq Because you are using an older version of MATLAB, your version does not support suppressing output variables. At line 130, we see this statement `[~,srcs] = cellfun(@fileparts, {srcs.name}, 'UniformOutput',false);`. You need to change the `~` to a dummy variable. As such, change **every** line you see that calls a function like this and replace it with something like `dummy`. Therefore: `[dummy,srcs] = cellfun(@fileparts, {srcs.name}, 'UniformOutput',false);`. You need to repeat this for line 132 as well. – rayryeng Jan 13 '15 at 04:09
  • Well,It raises another error :( ?? Error using ==> make>compiler_str at 226 Unsupported compiler Error in ==> make>pkg_config at 186 L_path = fullfile(opts.opencv_path,arch_str(),compiler_str(),'lib'); Error in ==> make at 95 [cv_cflags,cv_libs] = pkg_config(opts); – Barq Jan 13 '15 at 16:39
  • @Barq - Well unfortunately I can't help you with that. Suggest you leave an issue on the `mexopencv` github page. https://github.com/kyamagu/mexopencv/issues – rayryeng Jan 13 '15 at 16:41
  • OK,Thanks for helping,I have opened another question for that problem hoping any one can help me – Barq Jan 14 '15 at 00:58