I used the information here How to install g++ 10 on Ubuntu 18.04? to install gcc/g++ 10 on Ubuntu 20 and when I try to do it again:
sudo apt install g++-10
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++-10 is already the newest version (10.2.0-5ubuntu1~20.04).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
but when I ask for the version:
g++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Why is that and how can I fix it?
Update
However when I try:
g++-10 --version
g++-10 (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
It seems like g++10 is installed and usable under the name g++-10 but how can I make it the default g++ compiler?