title: MATLAB MEX can't find standard library with XCode 4.3 (Mac)
body: <p>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 MATLAB provided <a href="http://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/" rel="nofollow">XCode patch</a> which configures MATLAB to use the new llvm-gcc compiler under XCode 4.2+, but I am still getting the following error attempting to compile the example file using <code>mex timestwo.c</code>:</p>
  
  <pre><code>/Applications/MATLAB_R2012a.app/extern/include/matrix.h:852:20: error: stdlib.h: No such file or directory
  In file included from timestwo.c:1:
  /Applications/MATLAB_R2012a.app/extern/include/mex.h:161:19: error: stdio.h: No such file or directory
  </code></pre>
  
  <p>The compilation then breaks</p>
  
  <pre><code>mex: compile of ' "timestwo.c"' failed.
  
  Error using mex (line 206)
  Unable to complete successfully.
  </code></pre>
  
  <p>Clearly, the compiler can't find the standard library header directory, but what do I need to change to successfully compile? </p>