I'd like to experiment with the new GCC 5.1 C++ compiler on Ubuntu.
How can I install GCC 5.1 on Ubuntu?
I'd prefer some form of pre-built executable that I could just download and install, instead of downloading GCC's sources and building the whole GCC 5.1 from them.
Moreover, since I read libstdc++'s ABI changed in GCC 5, must a new version of libstdc++ be installed with GCC 5.1, too?
Package g++-5 (gcc version 5.2.1) is available in debian testing or in ubuntu wily. Previous milestones are 4.9 and 4.8. It would be more difficult to get a version in between, like 5.1.
If still satisfied with 5.2.1 then add this line to /etc/apt/sources.list:
deb http://ftp.debian.org/debian/ stretch main
Try to install package and its dependencies:
# apt-get update
# apt-get install g++-5
Then hope it is going to be installed without problems. (It strongly depends which ubuntu version is used on host.) A g++-4.9 install from stable debian (jessie) to ubuntu trusty (gcc 4.8) has been successful for me. When done comment out previously added line from sources list and
# apt-get update
If you are fond of eternal upgrades then set an apt pinning rule instead.