How I can set Microsoft Visual Studio 2017 compilers with MATLAB R2021a?
60 views (last 30 days)
Show older comments
Adnan Ghaderi
on 28 Dec 2022
Commented: Adnan Ghaderi
on 9 Jan 2023
Can I use Microsoft Visual Studio 2017 compilers with MATLAB R2021a?
I want to use mexopencv, but I can't set Microsoft Visual Studio 2017 in MATLAB, evenso I installed VS2017.
This is error when I am running mexopencv and mex -setup:
Error using mexOpenCV (line 73)
The OpenCV libraries were built using 'Microsoft Visual C++ 2017'.
Your compiler is 'MinGW64 Compiler (C)'.
These compilers may not be compatible.
Note that you can select a compiler using 'mex -setup' command.
>> mex -v -setup
... 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\TeamExplorer\').
... Executing command 'set "vcroot=C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer"&for /f "delims= " %a in ('type "C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt"') do @if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\VC\Tools\MSVC\%a\bin\HostX64\x64\cl.exe" call echo %vcroot%' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2017 (C)'.
0 Comments
Accepted Answer
Guru Kumaresan
on 9 Jan 2023
Hi Adnan,
By looking at the output from "mex -v -setup", the issue is caused by the Windows registry entry not pointing to the correct installation folder.
To resolve this issue for Visual Studio 2017, please reinstall it in "C:\Program Files (x86)\Microsoft Visual Studio\2017" and run "mex -v -setup" in MATLAB.
Since MATLAB has stopped relying on the registry entry from Visual Studio 2019, such issues will not be there with VS 2019 and later versions of VS.
More Answers (0)
See Also
Categories
Find more on MATLAB Compiler 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!