Unable to compile my .c files using the mex command under OS X.10.5 and Xcode 7.0

10 views (last 30 days)
Louis on 24 Sep 2015
Answered: Eman on 10 Oct 2018
when trying to compile my c files using the mex command I got the following message
Error using mex No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2015b/maci64.html.
when typing the 'mex -setup' command I got:
MEX configured to use 'Xcode with Clang' 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: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different C compiler, select one from the following:
Xcode with Clang mex -setup:/Users/LouisGiraudet/.matlab/R2015b/mex_C_maci64.xml C Xcode with Clang mex -setup:/Applications/MATLAB_R2015b.app/bin/maci64/mexopts/clang_maci64.xml C
To choose a different language, select one from the following: mex -setup C++ mex -setup FORTRAN >> I did the modification indicated in the matlab central link
It looks like some other link requires to be updated. Thanks for your reply

Answers (2)

Rahul Goel
Rahul Goel on 28 Sep 2015
This happens because MATLAB 2015b suports only Xcode 5.1+ or 6.x. However, with the recent upgrade of Xcode to 7.0, it became unrecognizable for MATLAB. You can try the following:
1. Go to preferences directory. You can get the path to this folder by executing:
>> prefdir
on the MATLAB command prompt.
2. Ensure that there is no mex_*.xml file present in this folder, delete if there are any.
3. Replace the MEX option files present in "MATLABROOT/bin/maci64/mexopts" directory with the ones attached in a zip file( "files.zip") with this post.
4. Restart the MATLAB.
Hope this helps

Eman on 10 Oct 2018
Hi, Thank you for your post. I have the same problem but I work on Mac, so I can not apply the same solution. Could any one help me? Thank you

Community Treasure Hunt

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

Start Hunting!

Translated by