I just went through same problem recently, the solution is pretty long.
- you have to install older version of GCC (4.0 or 4.1 or 4.2) in your system. I could not install it through Apt-get so had to manulay install it after downloading the setup. (I am using Ubuntu 10.04)
- Update in the symbolic links of Matlab ( user/.matlab/(MatlabVersion)/mexopts.sh) from "gcc" to version u installed, (eg: "gcc" to "gcc-4.1").
- Next problem I faced which you will also face probably. will be error in matlab while compiling "libstdc++.so.6:version GLIBCxx_3.4.9 not found".
problem:ipc_bridge is expecting the above version of libstdc++, but matlab refers to the libstdc++ version which was shipped with itself.
Solution:
- check if libstdc++.so.6 is present in "usr/lib/libstdc++.so.6". If not then install the package
- Update the "LDPATH_PREFIX" variable in file (MATLABINSTALLATIONPATH/bin/.matlab7rc.sh) for OPENGL to point to "usr/lib/libstdc++.so.6"
- Still Matlab will try to override the pointer to its own libstdc++. So remove all c++ and g++ related files from (MatlabInstallation/sys/os/glnx86). So Matlab has no choice but to use the library you installed. (may cause a bit of unstability in matlab)
PS:Backup Every file you edit or Remove.