Clear Filters
Clear Filters

mex -setup = max headaches

4 views (last 30 days)
Michael Epstein
Michael Epstein on 16 Feb 2017
Commented: Walter Roberson on 9 Mar 2017
Using newest 2016a version of Matlab
Windows 10 64 bit
mex -setup prompt (yields epic headache - bad documentation on the issue)
Having errors even choosing the default compilers on machine
mex -setup prompt (yields epic headache - bad documentation on the issue)
mex -setup cpp
mex -setup c++
a list of available compilers (I know I have many installed) but no list appears!
What's the deal? All three commands return same prompt (below) No selection or default compiler to choose from! I could use help,thanks!
>> mex -setup c++
>> mex -setup cpp
>> mex -setup
MEX configured to use 'Microsoft Visual C++ 2015 Professional' for C++ language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:

Answers (1)

Steven Lord
Steven Lord on 16 Feb 2017
The first part/line of that message (which is NOT an error message!) simply states that MATLAB was able to find 'Microsoft Visual C++ 2015 Professional' on your machine and will use that to create MEX-files. It's an informative message, not one that requires action from you.
The second part of that message, which starts with the word Warning, informs you of a change that you will need to make at some future time to react to an API change. We're giving you plenty of advanced notice (that message started appearing in release R2008a) in case you want to start updating your code now rather than waiting until you're required to update it.
If you had multiple compilers installed on your system and wanted to choose which compiler to use yourself, rather than letting MATLAB decide on your behalf, there should have been hyperlinks displayed after the warning message. From the documentation for release R2016a (the link actually goes to the page in the most recent documentation, currently release R2016b, but the quote below appears in both the 16a and 16b documentation.)
"If you have multiple MATLAB®-supported compilers for a language installed on your Windows® system, MATLAB selects one as the default compiler. You can change the default using the mex -setup language command. If you have multiple compilers, MATLAB displays a message with links to set up a different compiler."
I've confirmed that I see the hyperlinks in my installation of release R2016b. If you have multiple supported compilers installed but don't see the links, I recommend contacting Technical Support for help diagnosing the problem.
Roger Welte
Roger Welte on 8 Mar 2017
I have the same problem (as I see many others have had) specifying which compiler to use. There is the claim the setup command will allow us to choose the compiler, but it does not. The link provided is worthless in this regard - just going to the mathworks page about the 64-bit API, having nothing to do with how we set up the compiler we want to use. Does Mathworks provide the means of doing this or not? It shouldn't be this hard or mysterious.
Walter Roberson
Walter Roberson on 9 Mar 2017
What do you see for
mex -v -setup C

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!