check the gcc version use command
gcc --version
the first step:
sudo apt-get install gcc-4.8
then:
ls /usr/bin/gcc*
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
sudo update-alternatives --config gcc
check the gcc version again:
gcc --version
done
install g++ in the same way as gcc
note that:
gcc is for C, and g++ is for C++
reference:
https://www.linuxidc.com/Linux/2017-03/142299.htm