1.修改源:
sudo vim /etc/apt/sources.list
2.在文件末尾添加如下参数:
deb mirrors.dotsrc.org xenial main
deb mirrors.dotsrc.org xenial universe
3.ubuntu 更新
sudo apt update
4.安装
sudo apt install g++-5 gcc-5
5.替换
cd /usr/bin/
sudo rm g++
sudo ln -s ./g++-4.8 g++