MATLAB: Do I get several errors ‘Unable to locate build tool’ when validating the Toolchain with Microsoft Windows SDK 7.1 in R2015b

buildmexoptssdksimulink codertooltoolchainvalidate

I have installed Microsoft Windows SDK 7.1 as a compiler.
However, when I validate the Toolchain in a Simulink model, or when I generate code from it, I get the following errors:
### Validating other build tools …
Unable to locate build tool "Microsoft Visual C Compiler": cl
Unable to locate build tool "Microsoft Visual C Linker": link
Unable to locate build tool "Microsoft Visual C++ Compiler": cl
Unable to locate build tool "Microsoft Visual C++ Linker": link
Unable to locate build tool "Microsoft Visual C/C++ Archiver": lib
Unable to locate build tool "NMAKE Utility": nmake
Failed.
More interestingly, anytime I wish to setup my compiler with mex -setup, MATLAB does not remember the previous settings. Therefore, I am always asked to:
1) Select a compiler, by entering a number;
2) Verify my choice with [y].

Best Answer

This issue is related to the fact that the old workflow is being used for mex.
When setting the compiler with mex -setup, you should get the following message:
Trying to update options file: <path>\mexopts.bat
From template: <path>\mssdk71opts.bat
Navigate to the first directory, and remove the BAT file mexopts.
Try and run again mex -setup to select SDK 7.1 as compiler.
You should now be able to successfully validate the Toolchain and generate code from a Simulink model.