text 如何在Ubuntu LTS上安装最新的gcc(12.04,14.04,16.04)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 如何在Ubuntu LTS上安装最新的gcc(12.04,14.04,16.04)相关的知识,希望对你有一定的参考价值。

These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.

If you are still reading let's carry on with the code.

sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install gcc-snapshot -y && \
sudo apt-get update && \
sudo apt-get install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
sudo apt-get install gcc-4.8 g++-4.8 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;

When completed, you must change to the gcc you want to work with by default. Type in your terminal:
sudo update-alternatives --config gcc

To verify if it worked. Just type in your terminal
gcc -v

If everything went fine you should see gcc 6.1.1  by the time I am writing this gist

Happy coding!

See my blog post at https://www.application2000.com

以上是关于text 如何在Ubuntu LTS上安装最新的gcc(12.04,14.04,16.04)的主要内容,如果未能解决你的问题,请参考以下文章

如何在Ubuntu 20.04 LTS上安装Squid Proxy

无法在ubuntu 14.04.4 LTS上安装g ++(我试过命令和软件中心)

如何在 Ubuntu 上安装最新版本的 Mono 和 MonoDevelop?

ubuntu 18.04 LTS 安装nginx-1.14.0

求助,怎样在Ubuntu12.04LTS上搭建GTK开发环境

Ubuntu14.04LTS上安装Pip