1.if you need the gcc-4.7
do the following code to get it
sudo apt-get install gcc-4.7 gcc-4.7-multilib g++-4.7 g++-4.7-multilib
2.check version,set the priority
ls -l gcc*
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40
sudo update-alternatives --config gcc
and you will see the following:
选择 | 路径 | 优先级 | 状态 |
---|---|---|---|
0 | /usr/bin/gcc-4.4 | 50 | 自动模式 |
1 | /usr/bin/gcc-4.4 | 50 | 手动模式 |
2 | /usr/bin/gcc-4.5 | 40 | 手动模式 |
3 | /usr/bin/gcc-4.6 | 30 | 手动模式 |
and press enter
3.Again setting
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 40
reference link:
http://www.linuxdiyf.com/linux/1794.html
http://www.linuxdiyf.com/linux/13375.html