MATLAB 2018b cannot find Microsoft Visual C++ 2017 compiler when I run mex -setup

66 vues (au cours des 30 derniers jours)
Advait Thakre
Advait Thakre le 3 Déc 2021
Réponse apportée : Naresh le 12 Oct 2025 à 7:46
Installed MS Visual C++ 2017 compiler but it does not show up when I run mex -setup
  2 commentaires
Kiran Felix Robert
Kiran Felix Robert le 6 Déc 2021
What error message do you get, when you run the following command ?
mex -v setup
Could you please copy-paste the complete error message from MATLAB ?
Advait Thakre
Advait Thakre le 6 Déc 2021
>> mex -setup -v
Verbose mode is on.
... Looking for compiler 'Intel Parallel Studio XE 2015 with Microsoft Visual Studio 2015 (C)' ...
... Looking for environment variable 'ICPP_COMPILER15' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2015 with Microsoft Visual Studio 2015 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2016 with Microsoft Visual Studio 2015 (C)' ...
... Looking for environment variable 'ICPP_COMPILER16' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2016 with Microsoft Visual Studio 2015 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2015 (C)' ...
... Looking for environment variable 'ICPP_COMPILER17' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2015 (C)'.
... Looking for compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2017 (C)' ...
... Looking for environment variable 'ICPP_COMPILER17' ...No.
Did not find installed compiler 'Intel Parallel Studio XE 2017 with Microsoft Visual Studio 2017 (C)'.
... 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 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset').
... Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset\bin\gcc.exe' ...Yes.
... Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset' ...Yes.
Found installed compiler 'MinGW64 Compiler (C)'.
... Looking for compiler 'Microsoft Visual C++ 2013 (C)' ...
... Looking for registry setting 'HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
... Looking for registry setting 'HKCU\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7' 12.0 ...No.
Did not find installed compiler 'Microsoft Visual C++ 2013 (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 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset').
... Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset\bin\gcc.exe' ...Yes.
... Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset' ...Yes.
Found installed compiler 'MinGW64 Compiler (C)'.
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. You will be required
to update your code to utilize the new API.
You can find more information about this at:
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN

Connectez-vous pour commenter.

Réponses (3)

Kiran Felix Robert
Kiran Felix Robert le 9 Déc 2021
Hi Advait
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. Since we have stopped relying on the registry entry from Visual Studio 2019, we should not see such issues with VS 2019 and later versions of VS.
To resolve this issue for Visual Studio 2017 Professional, please reinstall (following the install instructions) in "C:\Program Files (x86)\Microsoft Visual Studio\2017" and run "mex -v -setup" in MATLAB.
  4 commentaires
Tamer Mellik
Tamer Mellik le 26 Fév 2024
followed every step still matlab can't locate the microsoft visual c++ compiler. 2021b and VS 2017
Walter Roberson
Walter Roberson le 26 Fév 2024
@Tamer Mellik which MATLAB release are you using?

Connectez-vous pour commenter.


Caspar
Caspar le 4 Déc 2024
Installing VS fully instead of only the build tools might help, it did for me:
Be sure to install the whole Visual Studio program, not only the build tools (MSVC v142 - VS 2019 C++), as otherwise MATLAB can't find it.
Tried getting MSVC v142 - VS 2019 C++ to work with MATLAB R2021a, running the following:
mex -setup -v C++
Resulted in:
Did not find installed compiler 'Microsoft Visual C++ 2019'.
After uninstalling MATLAB and VS Build Tools 2019, and installing MATLAB again and VS 2019 fully, not only the build tools, it worked out.
  1 commentaire
Ben
Ben le 20 Août 2025
I had a similar problem where MATLAB couldn't find MSVC C++ v141, 142 or 143 (I installed all 3 to see if it would fix the problem) and I did not want to install the full build tools.
I found that after installing the Windows SDK component, MATLAB could find the installed compilers. I attached an image of the components that I have installed.
I need some components for other purposes, but for MATLAB you at least need:
  • MSVC C++ build tools
  • Windows 10/11 SDK

Connectez-vous pour commenter.


Naresh
Naresh le 12 Oct 2025 à 7:46
Hello,
I had the similar problem in R2023a. my supported VS compiler is Microsoft Visual C++ 2019'.
How I resolve problem is to first install the VS compiler in you pc and then reinstall the matlab.
after installing the matlab , Open matlab in administration mode for the first time and run the mex -setup command.
In VS compiler, i have only select the basic and default checked boxes which are already present.
and it worked very well.
I had this problem in R2016a also but that time I struggle alot to resolve this as I was new to matlab.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by