How can I compile a C file in Matlab R2013a?

Hello, I have a problem while trying to compile a C file with Matlab R2013a, the error I get is:
>> mex fsmem_mvgm.c
/Applications/MATLAB_R2013a.app/bin/mex: line 305: llvm-gcc-4.2: command not found
/Applications/MATLAB_R2013a.app/bin/mex: line 1343: llvm-gcc-4.2: command not found
mex: compile of ' "fsmem_mvgm.c"' failed.
Error using mex (line 206) Unable to complete successfully.
Thanks.

1 件のコメント

Walter Roberson
Walter Roberson 2013 年 7 月 30 日
If you were using R2011* or R2012* the appropriate resource would be:

サインインしてコメントする。

回答 (3 件)

Walter Roberson
Walter Roberson 2013 年 7 月 30 日

0 投票

Be sure to install one of the supported compilers: see http://www.mathworks.com/support/compilers/R2013a/index.html?sec=maci64

2 件のコメント

Bakhan
Bakhan 2013 年 7 月 30 日
Thank you for your reply.
I already installed Xcode 4.6.3 as a supported compiler and I tried all the steps that described in http://www.mathworks.co.uk/support/solutions/en/data/1-FR6LXJ/ using Xcode 4.6 but it still doesn't work.
Walter Roberson
Walter Roberson 2013 年 7 月 30 日
You should probably contact support.

サインインしてコメントする。

Ken Atwell
Ken Atwell 2013 年 7 月 30 日

0 投票

R2013a should work without modification with modern versions of Xcode. There is no need for any patch -- do not install the patch intended for older releases of MATLAB.
But, it sounds like you may have already done this ("llvm-gcc" is a tip-off, 13a should use clang). If you have a backup in Time Machine, I would restore MATLAB to the state it was in before the patch was applied. Otherwise, I'm afraid you'll need to reinstall MATLAB, sorry.
If problems persist, post again to MATLAB Answers with updated error messages.

1 件のコメント

Bakhan
Bakhan 2013 年 8 月 5 日
Dear Ken Atwell,
Thank you so much.
I have fixed the issue by installing the command line tools for Xcode.
Regards

サインインしてコメントする。

Housen
Housen 2014 年 1 月 20 日

0 投票

I have encountered the same trouble. I use Mac OS 10.9.1 and Xcode 5.0.2. Since the command line tools are preinstalled, your solution does not help much. Instead of reinstalling Matlab, I found the following commands fix my problem:
cd /usr/bin
sudo ln -fs clang llvm-gcc-4.2
sudo ln -fs clang++ llvm-g++-4.2

6 件のコメント

Marc
Marc 2014 年 1 月 30 日
Hello Housen,
I tried using the lines of code you provided in the command window and it's giving an error of, "Undefined function 'sudo' for input arguments of type 'char'."
Please let me know if there is anything I can do on my end to fix this.
I am running OSX 10.9.1 and XCODE 5.0.2.
Walter Roberson
Walter Roberson 2014 年 1 月 30 日
You need to do those at a shell command prompt, not within MATLAB.
Or you could use
! cd /usr/bin; sudo ln -fs clang llvm-gcc-4.2; sudo ln -fs clang++ llvm-g++-4.2
but you might get difficulties if you had not recently authenticated with sudo.
Marc
Marc 2014 年 2 月 4 日
I tried doing that but nothing changed. I keep getting this error (any help is much appreciated!)
Error using feval
Undefined function 'nlplant' for input arguments of type 'double'.
Error in trimfun (line 118)
OUT = feval('nlplant',xu);
Error in fminsearch (line 191)
fv(:,1) = funfcn(x,varargin{:});
Error in trim_F16 (line 72)
[UX,FVAL,EXITFLAG,OUTPUT] = fminsearch('trimfun',UX0,OPTIONS);
Error in FindF16Dynamics (line 35)
[trim_state_hi, trim_thrust_hi, trim_control_hi, dLEF, xu_hi] = trim_F16(thrust, elevator, alpha,
aileron, rudder, velocity, altitude);
Walter Roberson
Walter Roberson 2014 年 2 月 4 日
Does it appear to have compiled? Or did it give the "command not found" error similar to what is shown in the original question? nlplant is something you defined in a mex file, right?
Marc
Marc 2014 年 2 月 5 日
It doesn't appear to have compiled nor did it give "command not found." I remember seeing nlplant a couple days ago but I do not recall what I did to get the nlplant to show.
Walter Roberson
Walter Roberson 2014 年 2 月 5 日
Does
which -any nlplant
show anything?

サインインしてコメントする。

質問済み:

2013 年 7 月 30 日

コメント済み:

2014 年 2 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by