MATLAB does not integrate nicely with Linux operating systems, and instead, provides its own copies of binaries, and libraries. These libraries are often outdated, which can cause problems such as the one below.
When calling external C++ compilers though the system() function, I found myself running into an eglibc error. This occurred when running MATLAB R2012a on a Debian Wheezy machine with eglibc 2.13 and gcc 4.7.1.
/tmp/hello-world: /opt/matlab/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /tmp/hello-world.so)
The solution is to override GNU Standard C++ Library version used by MATLAB, and force it to use the system version of the library by using LD_PRELOAD. Start MATLAB using the following command from the terminal which should solve your issues: