Matlab 2012a Mex与Mountain Lion上的Xcode 4.5一起使用

use*_*730 4 matlab xcode mex osx-mountain-lion

我安装了Mountain Lion和Xcode 4.5以及Matlab 2012a.我安装并运行了MathWorks网站上提供的补丁但是我仍然收到以下错误:

/Applications/MATLAB_R2012a.app/bin/mex: line 305: llvm-gcc-4.2: command not found
/Applications/MATLAB_R2012a.app/bin/mex: line 1326: llvm-gcc-4.2: command not found

mex: compile of ' "hello.c"' failed.
Error using mex (line 206)
Run Code Online (Sandbox Code Playgroud)

有没有已知的解决方案?

解决方案:打开Xcode - >首选项 - >下载 - >安装"命令行工具"

仍然需要MathWorks补丁.解决了我的问题.

小智 6

您不需要安装XCode.我安装了命令行工具,然后编辑文件"/Applications/MATLAB_R2012a.app/bin/mexopts.sh"和

将CC从gcc-4.2更改为llvm-gcc-4.2

将CXX从gcc-4.2更改为llvm-g ++ - 4.2

将SDKROOT设置为'/'

完成.现在,您只需要在MATLAB中运行"mex -setup"

为我工作(Mac OSX 10.8.2,命令行工具 - 2012年10月,MATLAB 2012a)