How I can set Microsoft Visual Studio 2017 compilers with MATLAB R2021a?

조회 수: 48 (최근 30일)
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)'.

채택된 답변

Guru Kumaresan
Guru Kumaresan 2023년 1월 9일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by