Matlab can not find installed compiler

41 ビュー (過去 30 日間)
Doron Joffe
Doron Joffe 2023 年 9 月 29 日
移動済み: Stefanie Schwarz 2024 年 6 月 11 日
I am trying to build a MEX function with Visual Studio 2022. I need to use Visual Studio Code and do not want to install the Visual Studio full addition.
The output that I get from mex -setup -v is the following:
... Looking for compiler 'Microsoft Visual C++ 2022 (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 "[17.0,18.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 "[17.0,18.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 "[17.0,18.0)" -products Microsoft.VisualStudio.Product.Community -property installationPath -format value' ...No.
Did not find installed compiler 'Microsoft Visual C++ 2022 (C)'.
I have tried to re-run the Visual Studio installer again and choose to perform a "Custom" setup. Then during installation, I enabled "Visual C++" under "Programming Languages". The problem still remained the same. Is there any solution I can tyry to implement.
  2 件のコメント
Bruno Luong
Bruno Luong 2023 年 9 月 29 日
編集済み: Bruno Luong 2023 年 9 月 29 日
What version of MATLAB do you have? If it is before 2022 then logically it won't support VS 2022.
Doron Joffe
Doron Joffe 2023 年 9 月 29 日
Thank you for the response. I am using R2023a. Just to clarify, I have installed a minimal Visual C++ Tools for use with Visual Studio Code. It contains the MSVC 2022 compiler and linker. I launched MATLAB from the Developer Command Prompt of VC, so all the environment variables are set.

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

採用された回答

Angelo Yeo
Angelo Yeo 2023 年 10 月 12 日
編集済み: Angelo Yeo 2023 年 10 月 12 日
VS Build Tools are not supported for MEX in R2023a. As a workaround, try to install Visual Studio Community to work with MEX commands. See the link below for further details.

その他の回答 (1 件)

Neha
Neha 2023 年 10 月 11 日
移動済み: Stefanie Schwarz 2024 年 6 月 11 日
Hi Doron,
I understand that you are facing an issue while building a MEX function and the Visual Studio Compiler could not be found. Please refer to the following MATLAB Answer to ensure that Visual Studio has been properly configured for use with MATLAB:
Hope this helps!

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by