how to install older version gcc/g++ in Ubuntu (other linux distro are similar)

When we compile some project, it needs older version gcc/g++ version. So how to insall older ones in ubuntu?

asked Apr 23, 2015 by harryxiyou (5,740 points)

1 Answer

 
Best answer

Install older gcc/g++ version

sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib

Set gcc/g++ version to be used automatically

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

You may need to create a symbolink for gcc-4.4 as follows

node2@node2:/usr/bin$ sudo ln -s gcc-4.4 gcc
node2@node2:/usr/bin$ sudo ln -s g++-4.4 g++
node2@node2:/usr/bin$ pwd
/usr/bin
answered Apr 23, 2015 by harryxiyou (5,740 points)
edited Apr 23, 2015 by harryxiyou

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...