Ubuntu currently provides gcc version 7.3, however gcc version 8.1 is currently available. I'd like to install gcc 8.1 alongside gcc 7.3 (so that if I call c++ it invokes the version from gcc 7.3, and if I call c++-8 it invokes the version from 8.1).
I tried following the instructions outlined in this question (but replacing 4.9 with 8.1), but gcc 8.1 isn't in the repository listed in the question:
$ sudo apt-get install gcc-8.1
[sudo] password for sky:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-8.1
E: Couldn't find any package by glob 'gcc-8.1'
E: Couldn't find any package by regex 'gcc-8.1'
How do I install gcc 8.1 in ubuntu 18.04?
Edit: This question isn't a duplicate because GCC updated the way versions are handled. It's now necessary to write sudo apt-get install gcc-8
instead of sudo apt-get install gcc-8.1
.