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

37 ビュー (過去 30 日間)
Zhongxing Zhou
Zhongxing Zhou 2024 年 10 月 7 日
コメント済み: Caspar 2024 年 12 月 4 日
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

採用された回答

Walter Roberson
Walter Roberson 2024 年 10 月 7 日
R2021a supports VS 2019 at newest.
  2 件のコメント
Zhongxing Zhou
Zhongxing Zhou 2024 年 10 月 7 日
Thank you! I will try VS 2019.
Caspar
Caspar 2024 年 12 月 4 日
Make sure to install VS 2019 fully, not only the build tools for C++ 2019.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by