Why does mex -setup fail to locate the MinGW-64 SDK that I just installed from the Add-On explorer in Matlab R2017a?

21 views (last 30 days)
I just installed MinGW-64 using the Add-On explorer. I run mex -setup from the Matlab command prompt, and I get the following error message:
Error using mex No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options, visit http://www.mathworks.com/support/compilers/R2017a/.

Answers (1)

Michelle Wu
Michelle Wu on 13 Mar 2017
It is probably because the environment variable MW_MINGW64_LOC is not set correctly during installation. Usually this variable should be set with the path of the MinGW installation folder. However, on some systems where users have limited privileges, there may policies in place preventing environment variables from being set.
In order to see whether the MW_MINGW64_LOC environment variable is set, run the "mex" command in verbose mode:
mex -setup -v
The solution is to have an administrator set the variable.
Please refer to the following MATLAB Answers post for more information:

Community Treasure Hunt

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

Start Hunting!