how to enable mex -setup for Visual Studio 2022 on MATLAB R2021a?

25 views (last 30 days)
Dear Colleagues,
I have installed Visual Studio Community 2022 and Matlab R2021a. When I opened MATLAB and run mex -setup -v, I cannot find the information that C++ is installed and Visual Studio is selected as the compiler for C/C++.
Detailed information of Visual Studio Community 2022and the matlab output is listed below. Would you please tell me some suggestions to solve this problem at your convinient time? Thanks!
>> mex -setup -v
Verbose mode is on.
... Looking for compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2015 (C)' ...
... Looking for environment variable 'ICPP_COMPILER18' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2015 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2017 (C)' ...
... Looking for environment variable 'ICPP_COMPILER18' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2017 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2019 (C)' ...
... Looking for environment variable 'ICPP_COMPILER18' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2018 with Microsoft Visual Studio 2019 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2015 (C)' ...
... Looking for environment variable 'ICPP_COMPILER19' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2015 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2017 (C)' ...
... Looking for environment variable 'ICPP_COMPILER19' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2017 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2019 (C)' ...
... Looking for environment variable 'ICPP_COMPILER19' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2019 with Microsoft Visual Studio 2019 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2017 (C)' ...
... Looking for environment variable 'ICPP_COMPILER20' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2017 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2019 (C)' ...
... Looking for environment variable 'ICPP_COMPILER20' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2020 with Microsoft Visual Studio 2019 (C)'.
... Looking for compiler 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...No.
Did not find installed compiler 'MinGW64 Compiler (C)'.
... Looking for compiler 'Microsoft Visual C++ 2015 (C)' ...
... 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 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7' 14.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2015 (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 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 15.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2017 (C)'.
... Looking for compiler 'Microsoft Visual C++ 2019 (C)' ...
... Looking for environment variable 'ProgramFiles(x86)' ...Yes ('C:\Program Files (x86)').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' ...Yes.
... Executing command '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Enterprise -property installationPath -format value' ...No.
... Looking for environment variable 'ProgramFiles(x86)' ...Yes ('C:\Program Files (x86)').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' ...Yes.
... Executing command '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Professional -property installationPath -format value' ...No.
... Looking for environment variable 'ProgramFiles(x86)' ...Yes ('C:\Program Files (x86)').
... Looking for file 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' ...Yes.
... Executing command '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -version "[16.0,17.0)" -products Microsoft.VisualStudio.Product.Community -property installationPath -format value' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2019 (C)'.
Error using mex
Supported compiler not found. You can install the freely available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options, visit
https://www.mathworks.com/support/compilers
Thank you!
Zhongxing

Accepted Answer

Walter Roberson
Walter Roberson on 7 Oct 2024
R2021a supports VS 2019 at newest.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!