How do I make MATLAB 2019b mex run with Visual C++ Build Tools 2015 compiler?

20 views (last 30 days)
After installing MATLAB 2019b I made a complete Installation of Visual C++ Build Tools 2015, including Windows 8.1 SDK, in order to generate specific .mex-files (MinGW was not an option here).
However, running
>> mex -v -setup c++
results in the following output:
...
... Looking for compiler 'Microsoft Visual C++ 2015' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 14.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe' ...Yes.
... Looking for folder 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC' ...Yes.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1' InstallationFolder ...Yes ('C:\Program Files (x86)\Windows Kits\8.1\').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2015'.
...
Error using mex
No supported compiler was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options,
Re-running the Visual C++ Build Tools 2015 setup in order to check the installation, it turned out that the Windows 8.1 SDK checkbox was now unchecked, although I explicitly checked it before installation.
It seems to me that this problem might be related to this issue here:
If a similar solution is applicable to my issue, then I am not sure how to obtain the right SDK 8.1 files and the corresponding patches, if they exist for SDK 8.1.
What steps are necessary in order to make Visual C++ Build Tools 2015 run with mex in MATLAB 2019b? Can you please give a complete solution (like in the aforementioned issue)?
Thank you very much in advance for your help.

Accepted Answer

Marcus Herbst
Marcus Herbst on 15 Jan 2020
This post here contains the solution to the problem:
Accordingly, adding the following entry to the registry made mex run with Visual C++ Build Tools (see attachment):
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7]
"14.0"="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\"
(It turned out to be no use manipulating either $matlabroot\bin\win64\mexopts\msvcpp2015.xml
and/or \AppData\Roaming\MathWorks\MATLAB\R2019b\mex_C++_win64.xml).
Thank you very much Stanislav Tereschenko for this straightforward solution!
Best regards
Marcus
  1 Comment
Iqra Karim
Iqra Karim on 20 Jun 2023
I have this entry in the registry but mex still can not find the visual studio c++ compiler. What could be the issue?

Sign in to comment.

More Answers (1)

shubham kumar gupta
shubham kumar gupta on 4 Feb 2021
Edited: shubham kumar gupta on 4 Feb 2021
I have uploaded 5 regedit export files in this Gdrive link which can solve your issue
[CAUTION EDIT LOCATIONS WHERE YOU HAVE INSTALLED YOUR VS]
This may help you to resolve missing keys
by clicking on edit you can see written inside them, after that you can also edit/export by yourself.
Also check your env paths here

Categories

Find more on MATLAB Compiler SDK in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!