mkdir -p $HOME/build/
cd $HOME/build/
git clone https://aur.archlinux.org/gcc49.git
cd gcc49
makepkg --syncdeps
sudo pacman --upgrade gcc-4.9.3-1-x86_64.pkg.tar.xz
[Alternative 2]: use one of the available AUR helpers:
example using pacaur (needs to be installed previously)
pacaur -S gcc49
To use the newly installed compiler, you have to set the correct version in the shell you are using:
export CXX=/usr/bin/g++-4.9
Note: this has to be done in each new shell you use. To make it permanent, add the line above to your ~/.bashrc
file.
Thank you!