title: How to tell mex to link with the libstdc++.so.6 in /usr/lib instead of the one in the MATLAB directory?
body: <p>Now mex in MATLAB 2012a only officially supports gcc 4.4.6 but I want to use gcc 4.7 at my own risk. Now If I compile something with mex directly, it will complain that</p>
  
  <pre><code>/usr/lib/gcc/i686-linux-gnu/4.7/cc1plus:
  /usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6:
  version `GLIBCXX_3.4.15' not found
  (required by /usr/lib/i386-linux-gnu/libppl_c.so.4)
  
  /usr/lib/gcc/i686-linux-gnu/4.7/cc1plus:
  /usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6:
  version `GLIBCXX_3.4.15' not found
  (required by /usr/lib/i386-linux-gnu/libppl.so.9)
  </code></pre>
  
  <p>By <code>strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep 'GLIBCXX'</code> I confirm that this <code>libstdc++.so.6</code> has that version string. I reviewed <code>mexopts.sh</code> and modified the variable <code>$RPATH</code> and <code>$MLIBS</code> in that script, but it doesn't work. So if I don't use symbolic link, where can I config the path of the <code>libstdc++.so.6</code> that mex uses? Thank you.</p>