| TSTOOL home page | TSTOOL documentation page | TSTOOL link page |
Dependent on the version you are using, Matlab will support only a certain range of gcc compilers. If you are using an unsupported gcc version, you will see a warning message like this during compilation:
Warning: You are using gcc version "X.X.X". The earliest gcc version supported with mex is "Y.Y.Y". The latest version tested for use with mex is "Z.Z.Z". To download a different version of gcc, visit http://gcc.gnu.org
While compiling with a newer gcc version often works despite the warning, you should still try to use a gcc version which your version of Matlab supports.
On many Unix systems (especially most Linux distributions), more than one version of gcc is installed, and often you can use one certain version by using an explicit command like gcc-X.Y. You can put the appropriate command into the mexopts.sh file (instead of just gcc and g++), which Matlab created for you during mex -setup. On Unix systems, it can be found in the directory .matlab/VERSION under your home directory.
Another problem can occur due to Matlab coming with its own versions of the standard C/C++ and gcc libraries (at least under Unix systems). This can lead to problems if your mex files were linked against another C library installed on your system. You will typically get an error like the following when calling such a mex file:
<MATLABROOT>/sys/os/glnx86/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)
There exist basically two options for solving this problem. Note that as far as we know, both are not officially supported by The Mathworks, but usually work nonetheless.
This option is a bit more cumbersome, but has the advantage that you can do this as normal user. Note that this command is only an example; check your library directories for the correct paths and file names.