1.) Press Ctrl+Alt+T 打開終端輸入設備
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
2.) Then install gcc 4.8 and g++ 4.8:
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8
3.) Once installed, run following commands one by one to use gcc 4.8 instead of previous version.
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++
4.) 使用 gcc --version 查看是否安裝成功,
gcc (Ubuntu 4.8.1-2ubuntu1~13.04) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
聯(lián)系客服