MATLAB: How to make MATLAB 2019b mex run with Visual C++ Build Tools 2015 compiler

MATLABmexsdk 8.1visual c++

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.

Best Answer

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
Related Question