Clear Filters
Clear Filters

How to setup MATLAB-Compiler to use MSVC2017 Build Tools

128 views (last 30 days)
I was able to sucessfully setup a system using the MATLAB 2018a compiler with Visual Studio 2017 Professional. However on another machine I only run the Visual Stiudio 2017 Build Tools which have all the files needed to compile but only lack the IDE. It seems this compiler is not yet supported by the MATLAB compiler. Is there a way / patch that allows usage of the build tools?
Thanks in advance!
  1 Comment
DureZehra Baig
DureZehra Baig on 19 May 2024
Hi dear, I am configuring Cube servo 3, Quarter. I installed window 2022, msvc2019 compiler does not support. What should I do? Please help

Sign in to comment.

Accepted Answer

Stanislav Tereschenko
Stanislav Tereschenko on 6 Oct 2018
Edited: Stanislav Tereschenko on 8 Oct 2018
I had the same problem to configure the C++ compiler provided by MSVC 2017 build tools with MATLAB R2018b. The solution was quite simple. If you look inside the file located here:
you will see, that MATLAB uses the entries in the registry to search for installed MSVC compilers. Therefore I only added a text entry to
with the name "15.0" and value "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools". After adding this entry, restart MATLAB and repeat the configuration of the mex compiler.
You can use the attached file to add this entry to the registry.
Best Regards!
James Z
James Z on 18 Jan 2023
I don't have "SxS\VS7" in registry in the path you noted here. Would you please advise how to add MSVC 2022 for Matlab?

Sign in to comment.

More Answers (3)

Simon Weßel
Simon Weßel on 23 Mar 2020
Do you know a workflow to integrate the build tools of the current Visual Studio version (2019) into MATLAB/Simulink?
Johannes Wüthrich
Johannes Wüthrich on 1 Feb 2022
Edited: Johannes Wüthrich on 2 Feb 2022
Thanks @Bram De Cooman! Like this I was perfectly able to configure MSVC Build Tools 2019 as compiler in MATLAB 2020b and MATLAB 2021b. See or, most likely, the XMLs can also be applied to later MATLAB versions.
Jitesh Patel
Jitesh Patel on 14 Feb 2022
Thank you for sharing the xml files for 2021b - It worked on 2021b on Windows 10.

Sign in to comment.

Robert on 12 Jun 2019
Edited: Robert on 12 Jun 2019
R2017b could not find the compiler. Had installed VS Community earlier, then installed VS Pro then removed Community. Needed to manualy change the registry entry referenced above to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\
Karl Erik Thoresen
Karl Erik Thoresen on 28 Dec 2019
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\
Kiran Jojare
Kiran Jojare on 8 Apr 2022
Can you please provide any attachment of directory . I am trying my hands on 2017b but still after updating the registery I am not able to locate MSVC after mex -setup -v command?

Sign in to comment.

Iqra Karim
Iqra Karim on 20 Jun 2023
I have the 2019a version of MATLAB. I also have Visual Studio Community 2019 installed. However, mex can not find the said compiler. How can I fix this?
Sven Merk
Sven Merk on 21 Jun 2023
maybe you also need the msvc2019 file. You'll find it attached here.

Sign in to comment.


Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!