MATLAB MEX can't find standard library with XCode 4.3 (Mac)

前端 未结 3 1690
傲寒
傲寒 2021-01-13 11:14

I am getting started with using MEX files for MATLAB (R2012a) compiled from C code (using XCode 4.3) on my Mac (running OSX 10.7.3, Lion). I have already installed the MATLA

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-13 12:04

    I am running Mac Mountain Lion and Matlab R2012b, and the following solution worked for me: Matlab 2012a Mex to work with Xcode 4.5 on Mountain Lion

    To be precise, I was getting the following errors:

    error: stdio.h: No such file or directory

    error: stdlib.h: No such file or directory

    error: math.h: No such file or directory

    So what I did to solve this issue:

    I installed Xcode with Command Line Tools, and then edited the file "/Applications/MATLAB_R2012b.app/bin/mexopts.sh" by:

    changing CC from gcc-4.2 to llvm-gcc-4.2

    changing CXX from gcc-4.2 to llvm-g++-4.2

    setting SDKROOT to '/'

    Then I ran "mex -setup" in MATLAB, chose number 1, and chose y to overwrite the old /Users/insertyournamehere/.matlab/R2012b/mexopts.sh

    That solved it :)

提交回复
热议问题