Ubuntu 12.04 LTS 安装GCC 4.8

gcc 4.8.1 是第一个完全支持C++11 的编译器,Windows上可以安装mingw版的,,在sourceforge 上有下载,安装也比较方便。在Linux上安装的话需要首先安装一些依赖库。在Ubuntu 12.04 lts默认安装的是gcc4.6.3,其实该版本也支持一些c++11的特性,可以通过增加“-std=c++0x” 编译选项来使用这些特性,但是对多线程库的支持较差,gcc 4.8.1 是通过ppa来安装的,因此需要安装ppa repository 。下面就来看一下安装步骤:首先安装依赖:sudo apt-get install libgmp-devsudo apt-get install libmpfr4 libmpfr-devsudo apt-get install libmpc-dev libmpc2sudo apt-get install libtoolsudo apt-get install m4sudo apt-get install bisonsudo apt-get install flexsudo 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的版本:

网络条件不好的话,安装过程比较慢,可以使用网易或者sohu的源提高安装速度。

在前进的路上,主动搬开别人脚下的绊脚石,有时往往也是为自己铺路。

Ubuntu 12.04 LTS 安装GCC 4.8

相关文章:

你感兴趣的文章:

标签云: