Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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?

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading