How can I install
g++-7 on Ubuntu? I did
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
Then I can find
g++-6 packages, but not
g++-7. What problems may I encounter when using
g++-7? When will it be officially released?
The repository method alone does not work because you are not using Ubuntu 17.04 (Zesty), which is the release for which the package was built, as you can see in the ppa:
The easiest alternative is to "pin that package" (this is, to tell your Ubuntu to accept a package that is not build for your version). To do so, open a terminal, and type:
sudo nano /etc/apt/preferences
Then, copy to it the following:
Package: gcc-7 Pin: release n=zesty Pin-Priority: 990
Finally, save the file (press Ctrl+X and then
Now, after a
sudo apt-get update, install with
sudo apt-get install gcc-7. It should install all required dependencies too.
Note: as a development package, it might require newer libraries which your current Ubuntu version does not have. This might break some packages.