如何在Ubuntu 10.04中将gcc更新到最新版本(在本例中为4.7)?

我有Ubuntu 10.04 32位,当前安装了gcc 4.4.3 。 我想将它升级到gcc/g++ 4.7 (我正在寻找C ++ 0x支持)

如何使用Ubuntu Package Manager进行更新:

 apt-get upgrade/install ?? 

作为第二个选项,我从以下位置下载了最新的gcc快照文件:

 http://gcc.cybermirror.org/snapshots/LATEST-4.7/gcc-4.7-20110709.tar.bz2 

会做的

 ./configure make make install 

在这个包上构建并从源代码安装它?

12.04

添加工具链ppa测试库,然后执行apt-get update和apt-get dist-upgrade

 sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install g++-4.7 c++-4.7 

这仅在12.04中可用 – 较旧的ubuntu版本无法使用此方法更新到同一版本。

有关PPA的更多信息,请参见此处
https://help.launchpad.net/Packaging/PPA

 sudo apt-get install gcc-snapshot 

然后,使用以下命令调用它:

 /usr/lib/gcc-snapshot/bin/gcc 

对于问题的第二部分,答案是“是的,有点”。 如果你真的想这样做(即安装gcc-snapshot包还不够)那么你需要安装依赖项:

 sudo apt-get build-dep gcc-snapshot 

然后,找到正确的配置选项:

 gcc -v 

(并修改安装路径等)

然后,像这样构建:

 mkdir objdir cd objdir ../gcc-src-dir/configure ......insert..options..here... make make install 

10.04 LTS

使用以下命令安装add-apt-repository

 apt-get install python-software-properties 

然后按照12.04 LTS所述添加tooclain ppa test repo。

如何在Ubuntu 10.04上安装gcc 4.8:

 sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8 sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++ 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++ 

validationgcc版本:

 g++ --version 

它在我的机器上工作。 资料来源: http : //ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/