Does MATLAB R2015b support Microsoft Visual C++ 2015 Professional for mex compilation?

19 views (last 30 days)
On a Windows 10 Pro 64-bit platform, I've installed Microsoft Visual Studio 2015 and then upgraded MATLAB to R2015b since this is a valid combination according to "http://www.mathworks.com/support/compilers/R2015b/win64.html".
When running "mex -setup -v", MATLAB R2015b cannot find a compiler and throws the error "No supported compiler or SDK was found."
A closer look at the command windows reveals that MATLAB did find the following registry setting: "Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\')"
However, MATLAB then looks for "cl.exe" and this cannot be found: "... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe' ...No".
I've searched for the file "cl.exe" on my PC and I cannot find it anywhere.
My Microsoft Visual Studio installation reports:
Microsoft Visual Studio Professional 2015 Version 14.0.24720.00 Update 1
Microsoft .NET Framework Version 4.6.01038
Installed Version: Professional
Visual Basic 2015 XXXXX-XXXXX-03552-AA263 Microsoft Visual Basic 2015
Visual C# 2015 XXXXX-XXXXX-03552-AA263 Microsoft Visual C# 2015
Visual C++ 2015 XXXXX-XXXXX-03552-AA263 Microsoft Visual C++ 2015
Is this the correct tool?
Many thanks
Shaun Cummins

Accepted Answer

Rahul Goel
Rahul Goel on 6 Jan 2016
Hi Shaun,
As per the link below, MATLAB R2015b does support Visual Studio 2015 Professional Edition for compilation purposes: http://www.mathworks.com/support/compilers/R2015b/index.html
Try uninstalling and re-installing the Visual Studio to see if it helps.
  1 Comment
Shaun Cummins
Shaun Cummins on 6 Jan 2016
Yes, I've tried the inevitable re-installation but there's no difference.
Is MATLAB pointing to the correct compiler "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe"?
This executable doesn't exist on my installation of Microsoft Visual Studio 2015 Professional.
Many thanks for your help
Shaun

Sign in to comment.

More Answers (2)

Shaun Cummins
Shaun Cummins on 7 Mar 2016
Edited: Walter Roberson on 7 Mar 2016
Thank you SG for your help.
I did spend some time this weekend and I've found the source of my problem.
It transpires that when installing Microsoft Visual Studio 14.0/2015, the "Typical" installation does NOT include C/C++. One has to remember to select "Custom" and choose C/C++.
In order to avoid repeating information here, see this page (note that the comments are rather amusing and well worth a read): https://blogs.msdn.microsoft.com/vcblog/2015/07/24/setup-changes-in-visual-studio-2015-affecting-c-developers/
What I think was really confusing is that the "Typical" installation didn't install the compiler are desired but DID add a couple of the locations and add one entry into the Windows registry. If it hadn't done either of those then it would have been more clear that the installation hadn't done what I'd intended.
It does work very well now and there's no problem.
I bet that there will be a number of users that fall foul of this problem.
Many thanks for your help everyone who responded.
Regards
Shaun Cummins
  1 Comment
Jakob Nikolas Kather
Jakob Nikolas Kather on 19 Dec 2016
Thank you very much. I spent two days looking for a problem with my "Microsoft Visual Studio 2015 Professional" installation and my "Matlab R2016b" installation until I read you post...

Sign in to comment.


SG
SG on 7 Mar 2016
Edited: SG on 7 Mar 2016
In order to solve this issue you need to create symbolic links to the correct locations.
If you are using Windows 7(64) the correct path for 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe' in VS 2015 is 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\cl.exe'. You can make a symbolic link to a folder like this in command line (admin mode):
mklink /D C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64
You will also need to create another symbolic link to 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe'.
You can get MATLAB to recognise Visual Studio Express (VSE) 2015 as Visual Studio Professional (VSP) by creating a symbolic link.
In VSE 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe' does not exist. VSE uses WDExpress.exe as devenv.exe. You will need to to create a symbolic link in command line (admin mode):
mklink /D C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\WDExpress.exe
PS: When you are working with MATLAB mex, make sure you enable verbose mode by adding -v to the end of your setup command. Look at the output and see what is that mex looking for and where. Find the right locations and make symbolic links to them.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!