Reputation: 1777
I'm trying to compile some .cpp
files from the fileexchange. I have installed Microsoft Visual Studio 2017 as instructed here (so with the actual C++ compiler).
These components are installed:
When I run mex setup -v
I get output seemingly indicating that some things were found (before this text there were a couple of lines that said 'looking for compiler' ... 'No.'):
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 14.0 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\').
... 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 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\').
... 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 environment variable 'VS140COMNTOOLS' ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2015 Professional (C)'.
... Looking for compiler 'Microsoft Visual C++ 2017 (C)' ...
... 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 ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\').
... Executing command 'set "vcroot=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"&for /f "delims= " %a in ('type "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt"') do @if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe" call echo %vcroot%' ...Yes ('C:\Program Files (x86)\Microsoft Visual Studio\2017\Community').
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0' InstallationFolder ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0' InstallationFolder ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0' InstallationFolder ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0' InstallationFolder ...No.
Did not find installed compiler 'Microsoft Visual C++ 2017 (C)'.
Note that there are several lines that end with 'yes', where it finds the directories that visual studio uses. But it then ends with this error that says that no compiler was found:
Error using mex
No supported compiler or SDK was found.
Apparently two bugs were associated with this (1, 2) and I applied those fixes. But then still I get the same error. How do I get matlab to recognize the compiler?! This is maddening.
This problem arises with windows 10, matlab 2017a and visual studio 2017 community, which should be compatible according to here. Does anybody know how to get this to work?
There are many questions about this both on several stack exchanges and on the matlab forum. All solutions entail checking compatibility or applying the bug fixes, as explained above. Those things Ive tried already, so thats why Im asking here now.
Upvotes: 1
Views: 1154
Reputation: 1777
Ok so the answer was to install both of these visual studio components:
Windows 10 SDK (need to get the version to match your windows!)
VC++ 2017 v141 tools
In addition to applying this bugfix:
It is hard to find this information, hope this will help people.
Upvotes: 3