I'm using Ubuntu 18.04 LTS, when I try to install g++-10:
sudo apt install g++-10
it installs clang-10, but I don't need clang-10, I strictly need a g++-10
I'm using Ubuntu 18.04 LTS, when I try to install g++-10:
sudo apt install g++-10
it installs clang-10, but I don't need clang-10, I strictly need a g++-10
The issue here is that the default Ubuntu 18.04 repositories don't contain g++-10
(but do contain clang-10
)
On 18.04, if apt
fails to match an exact package name, it expands the name as a regular expression1. In this context, the +
character means "one or more of the preceding character" so g++-10 matches clang-10 (it's just coincidental that they're both compilers).
If you want gcc-10 / g++-10 on 18.04 you can do so by adding the toolchain-r PPA to your repositories:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install g++-10
See also
Notes:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install g++-10
g++-10
available in any of the repositories that are configured for your system (it's not in the default Ubuntu repositories), soapt
is treatingg++-10
as a regex and matching anything with at least oneg
followed by-10
. AFAIK if you want to installg++-10
on 18.04 you will need to do so from a PPA (I use the toolchain-r PPA myself) – steeldriver May 27 '21 at 12:24