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