1

I have MATLAB 2010a, and I would like to compile my script to a stand alone windows .exe file. The issue is when I use mbuild -setup, there is no option for my Visual Studio 2010. I saw that there is a patch for MEX files, I installed this patch put it does not help.

>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications: 

Would you like mbuild to locate installed compilers [y]/n? n

Select a compiler: 
[1] Microsoft Visual C++ 2005 SP1 
[2] Microsoft Visual C++ 2008 Express 
[3] Microsoft Visual C++ 2008 SP1 

[0] None 

Any Ideas?

If I choose [3], it cannot find it anyway. I do not care what compiler I use, I just want it to work.

Edit

If I select [y] when asked Please choose your compiler for building standalone MATLAB applications:, I get the following:

>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications: 

Would you like mbuild to locate installed compilers [y]/n? y

Select a compiler: 

[0] None 

Compiler: 0

mbuild: No compiler selected. No action taken.

Shinobii

Shinobii
  • 2,401
  • 5
  • 24
  • 39
  • What happens if you answer 'y' to the option of searching for installed compilers? – Isaac Jul 27 '12 at 21:48
  • I have added an edit to my initial question. – Shinobii Jul 27 '12 at 22:01
  • @Shinobii: Just to be clear, you are talking about the patch mentioned here: [Setting up mex to use the Visual Studio 2010 compiler](http://stackoverflow.com/q/4078094/97160) – Amro Jul 29 '12 at 17:47

2 Answers2

2

According to the list of supported and compatible compilers, although a patch was made available to support VS2010 for MEX compilation only, MATLAB Compiler products in R2010a are not compatible with VS2010 (at least not officially).

If you are up to it, know that mbuild on Windows calls a Perl script ($matlabroot\bin\mex.pl), and uses its result to build a command to run (as DOS/batch). You could perhaps try to hack it yourself to make it work with VS2010. Just don't expect any help from me on that, the file has almost 3000 lines of Perl code :) Lucky for you it seems well commented.

Otherwise consider upgrading your MATLAB installation to the latest version (VS2010 is supported out of the box)...

Amro
  • 123,847
  • 25
  • 243
  • 454
1

This site indicates that you can set your environment variables such that your compiler will be recognized by running vsvars32.bat. Specifically, it looks like the MSVCDIR variable has to be set appropriately.

Isaac
  • 3,586
  • 1
  • 18
  • 20
  • Thanks for your reply, I tried looking into it, but cannot seem to get it to work. I will take Amro's advice and just upgrade my Matlab. Thanks again. – Shinobii Jul 30 '12 at 13:27