I have installed gcc-12 and g -12 on my Ubuntu 22.04 system.
How do I make them the default versions used when I call gcc/g in terminal?
CodePudding user response:
First you need to remove the current gcc and g symbolic links:
sudo rm /usr/bin/gcc
sudo rm /usr/bin/g
Then, create a new symbolic link for gcc and g version 12:
sudo ln -s /usr/bin/gcc-12 /usr/bin/gcc
sudo ln -s /usr/bin/g -12 /usr/bin/g
To make sure that everything has worked fine check the gcc and g version:
gcc --version
g --version
You should get 12.1.0