ubuntu 选择gcc 版本

前端之家收集整理的这篇文章主要介绍了ubuntu 选择gcc 版本前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

http://stackoverflow.com/questions/7832892/how-to-change-the-default-gcc-compiler-in-ubuntu


To figure out the current priorities of gcc,type in the command pointed out by @tripleee's comment:

查看当前的可切换的版本: update-alternatives --query gcc
设置为4.5
update-alternatives --set g++ /usrbing++-4.5update gcc gcc- cppbin cpp4.5

Here,4.6 is still the default (aka "auto mode"),but I explicitly switch to 4.5 temporarily (manual mode). To go back to 4.6:

方法二:例如有 4.6 4.5 两个版本updateinstall /usrbing++ g ++-4.6 100 update4.550gcc gcc gcc-cpp cppbin cpp50--auto gcc update cppbin
echo 'export CXX=/usr/bin/gcc-4.5'>>~/.bashrc
移除当前的选择可以这样

First erased the current update-alternatives setup for gcc and g++:


 
 
Install Packages

It seems that both gcc-4.3 and gcc-4.4 are installed after install build-essential. However,we can explicitly install the following packages:

 
     

sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++sudo apt-get install gcc-4.3 gcc-4.4 g++-4.3 g++-4.4
 

First erased the current update-alternatives setup for gcc and g++:

sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++

Install Packages

It seems that both gcc-4.3 and gcc-4.4 are installed after install build-essential. However,198); word-wrap:normal">sudo apt-get install gcc-4.3 gcc-4.4 g++-4.3 g++-4.4

猜你在找的Ubuntu相关文章