Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Mex compiler of matlab does not work with following error

Warning: You are using gcc version "4.7.2-2ubuntu1)".  The version
         currently supported with MEX is "4.4.6".
         For a list of currently supported compilers see: 

/home/krm/matlab/bin/mex: 1: eval: g++: not found

    mex: compile of ' "fv_cache/"' failed.

it is obvious that I need preceding version of gcc but this specific version is not included in software manager of mint. I installed gcc-4.4 but it does not recognized by Matlab. I also removed latest version from my computer and set gcc as a environment variable points to gcc-4.4 but again does not work.

Is there any other way around to solve that issue? Maybe a interface or something.

share|improve this question
up vote 0 down vote accepted

You can try this. It works on Ubuntu, so it may work for you.

Ubuntu comes with 3 versions of gcc. One of the versions is gcc-4.4. I just installed this version using apt-get install gcc-4.4.

After installing you need to tell which of the installed versions is the active one (you want to work with). You can switch back and forward among different versions using the command update-alternatives. The command below on the terminal makes gcc-4.4 the active version.

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50

For me, it does now work and mex files are compiled an executed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.