MATLAB Answers

Error using mex 'No supported compiler was found' on Mac.

96 views (last 30 days)
Hannah West
Hannah West on 8 Jul 2019
Commented: Koren Murphy on 8 Dec 2020
I am trying to run a c++ program in Matlab. To do this I am using mex. I have a mac.
I was trying to get my c++ files to run but that wasn't working so to begin with I have been trying to use this example provided by MATLAB: https://uk.mathworks.com/help/matlab/matlab_external/build-an-executable-mex-file.html
Each time I run the command 'mex timestwo.c' I recieve the same error as when I was trying to get my own programme to run. The error says:
'Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.'
This seems to be a very common problem and I have looked through all the guidance I can find but I am still recieving the same error. I have xcode 10.x and MATLAB 2019a and I have accepted the Xcode licence.
Thank you in advance

  2 Comments

Jan
Jan on 8 Jul 2019
Matlab needs a installed compiler for the compilations. Did you install XCode? If so, which version? What is the output of:
mex -setup
?
Hannah West
Hannah West on 9 Jul 2019
Thanks Jan for the quick response. I am using Xcode Version 10.2.1 (10E1001). The output of 'mex -setup' is the same error I was receiving before.
'Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.'
But I have installed xcode and I have accepted the license.
Thanks
Hannah

Sign in to comment.

Answers (1)

Jan
Jan on 9 Jul 2019
Edited: Jan on 9 Jul 2019
Posting the error message offers new insights. Did you try this already - in a command shell of the operating system:
sudo xcodebuild -license accept

  3 Comments

Hannah West
Hannah West on 9 Jul 2019
Yes I have, and still no luck! And I also checked it was looking in the right place using
'sudo xcode-select -s /Applications/Xcode.app/Contents/Developer'
fadams18
fadams18 on 14 Aug 2020
did you find a solution? I have the same issue
Koren Murphy
Koren Murphy on 8 Dec 2020
I am also having the same issue - was the solution found?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!