MATLAB 2018b cannot find Microsoft Visual C++ 2017 compiler when I run mex -setup
45 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Installed MS Visual C++ 2017 compiler but it does not show up when I run mex -setup
2 Kommentare
Kiran Felix Robert
am 6 Dez. 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 ?
Antworten (2)
Kiran Felix Robert
am 9 Dez. 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 Kommentare
Tamer Mellik
am 26 Feb. 2024
followed every step still matlab can't locate the microsoft visual c++ compiler. 2021b and VS 2017
Caspar
am 4 Dez. 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 Kommentar
Ben
am 20 Aug. 2025 um 9:04
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

Siehe auch
Kategorien
Mehr zu MATLAB Support for MinGW-w64 C/C++ Compiler finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!