64-bit Linux and Matlab mex solution

Ever gotten the error below?
Warning: You are using gcc version "4.5.2-8ubuntu4)". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:


I recently did when making some S-functions in simulink (matlab).

After some Googling a found this post which had the answer. You can use their solution or the following script:

sudo updatedb # it is required to have run this after you installed matlab, the command below uses this
cd $(dirname $(locate "sys/os/glnxa64/"|tail -1)) # change dir to matlab path
mv libstdc++.so.6 libstdc++.so.6.orig # this...
mv libgcc_s.so.1 libgcc_s.so.1.orig # and this is the actual fix

You don’t even have to restart Matlab.

One Response to “64-bit Linux and Matlab mex solution”

  1. kafsays Says:

    when i m applying this……
    i have found d below errors…..

    dirname: missing operand
    Try `dirname –help’ for more information.

    my system is 32-bit

    can you hust help me to compile CPP file with mex compiler in linux(UBUNTU 11.04)…matlab r2011a

Leave a Reply

× one = 9