随手备忘 ubuntu12.04 lts 安装gcc 4.8

最新非专业学习一下C++11特性,需要升级 gcc 到 4.8.1,记录一下安装过程。

首先安装依赖:

sudo apt-get install libgmp-dev
sudo apt-get install libmpfr4 libmpfr-dev
sudo apt-get install libmpc-dev libmpc2
sudo apt-get install libtool
sudo apt-get install m4
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install autoconf

接下来进入到安装gcc4.8.1 的主要步骤:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test 
sudo apt-get update 

sudo apt-get install gcc-4.8 
sudo apt-get install g++-4.8 
sudo apt-get install gcc-4.8-multilib 
sudo apt-get install g++-4.8-multilib 
sudo apt-get install gcc-4.8-doc 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 
sudo update-alternatives --config gcc 
sudo update-alternatives --config g++ 

sudo apt-get update 
sudo apt-get upgrade -y 
sudo apt-get dist-upgrade

之后就可以使用了,通过使用gcc -v 命令可以查看当前gcc的版本。

posted @ 2014-08-07 14:14  克莱尔孙  阅读(187)  评论(0编辑  收藏  举报