Visual Studio 2013 support for Matlab 2013a/b

Back to Blog

24.10.2013 (25.05.2015)

In this post I will provide an unofficial way to add Visual Studio 2013 support into Matlab 2013a/b. The same files may or may not also work with previous or upcoming versions.

64-bit Matlab

In a default-installation of Matlab 2013b 64-bit, the options files and scripts are located at the directory

C:\Program Files\MATLAB\R2013b\bin\win64\mexopts

Extract the .zip package from below into the directory above.

VS2013 support for Matlab 2013a/b 64-bit

32-bit Matlab

In a default-installation of Matlab 2013b 32-bit, the options files and scripts are located at the directory

C:\Program Files (x86)\MATLAB\R2013b\bin\win32\mexopts

Extract the .zip package from below into the directory above.

VS2013 support for Matlab 2013a/b 32-bit

Modifications to the files

Here is a table of version-values related to each version of Visual Studio.

Year Version Same Windows SDK cl.exe Sub-directory
2012 11.0 110 8.0 17.0 win8
2013 12.0 120 8.1 18.0 winv6.3

The sub-directory was obtained by examining the registry key

SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1

which reveals the path

C:\Program Files (x86)\Windows Kits\8.1

Its lib directory shows the correct sub-directory to be winv6.3.

To produce the given files for VS2013, I took the options files for VS2012

msvc110opts.bat
msvc110opts.stp

and copied them to

msvc120opts.bat
msvc120opts.stp

I then replaced the version numbers with the ones given in the table above.

Disclaimer

Of course, adding full support for a compiler cannot be as simple as that. This means that the above may or may not work for you, depending on which kind of things you will build. However, it does work for me, and it’s worth trying if you have no other option. If it does not work, then you will probably have linking errors, or crashing mex files, but you’ll find soon enough:p I needed the support because I am using the C++11 features that were introduced in VS2013.