MATLAB Function Simulink Block "Make Error"

9 views (last 30 days)
Juan
Juan on 28 Oct 2011
Hi, So I'm new with Simulink, I have the student version on my mac and I'm trying learn how to use MATLAB function blocks so I tried the example from the help menu. However, when I run it I get a "Make error":
Making simulation target "test_sfun", ...
/Applications/MATLAB_R2011a_Student.app/bin/mex -c -O -DMATLAB_MEX_FILE -I/Applications/MATLAB_R2011a_Student.app/toolbox/stateflow/stateflow/../../../simulink/include -I/Applications/MATLAB_R2011a_Student.app/toolbox/stateflow/stateflow/../../../extern/include -I/Applications/MATLAB_R2011a_Student.app/stateflow/c/mex/include -I/Applications/MATLAB_R2011a_Student.app/stateflow/c/debugger/include test_sfun.c /Applications/MATLAB_R2011a_Student.app/bin/mex: line 305: gcc-4.2: command not found /Applications/MATLAB_R2011a_Student.app/bin/mex: line 1041: gcc-4.2: command not found
mex: compile of ' "test_sfun.c"' failed.
gmake: * [test_sfun.o] Error 1
Can anyone please tell me how to fix this?
Cheers!

Answers (2)

Ken Atwell
Ken Atwell on 4 Nov 2011
A Fangjun, indicated, you need a C compiler, namely the one provided with Xcode. If you already have (or now install) Xcode v4.2 (the newest version, released in the last couple of weeks), you will still get this error since recent versions of MATLAB are configured to use a compiler that is no longer provided as-of Xcode v4.2.
The MathWorks solution Can I use XCode 4.2 as my C compiler in MATLAB R2011b? may be helpful. You can get information on the officially supported compilers at Supported and Compatible Compilers – Release 2011b
  1 Comment
Egor
Egor on 8 Oct 2012
thank you! worked for me for solving stateflow mex compiler on osx 10.8.2 with Xcode 4.5.2

Sign in to comment.


Fangjun Jiang
Fangjun Jiang on 28 Oct 2011
It might be that you don't have a C compiler. Or you have not set up mex yet. try to run
mex -setup

Categories

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!