I'm using Ubuntu 14.. Currently my gcc compiler is v5.1.. But now I need to use Matlab mex, which so far only supports gcc-4.7.*. Is it possible to install the gcc-4.7 compiler without reinstalling gcc-5.1? What problems would be expected? Or is there any manual for running two gcc compilers on the same Ubuntu system?

Moreover, if installing and running two compilers can be done, will (totally) removing one affect the functionality of the other one?

I really don't want to remove the gcc-5.1 since it supports new C++ features/functions and my experience of installing a non-default gcc compiler was pretty unpleasant.


The standard 14.04 comes with gcc-4.8 and gcc-4.7 installed. If you want c++ features, install the g++ compiler. The executables all have different names, but the links like /usr/bin/gcc usually point to the default compiler -- change if you want to. Of course, you can always install a compiler in a separate location, like your home directory, and avoid all conflicts that way, just having to run a setup script to change some paths, env. variables and maybe aliases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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