Tuesday, May 14, 2024
35
rated 0 times [  35] [ 0]  / answers: 1 / hits: 158457  / 3 Years ago, wed, august 25, 2021, 3:00:17

After installing Ubuntu 16.04 LTS, I found that gcc 5.3 installed by default but I don't receive any updates to gcc. I opened up GCC website and I found the new release 6.1. How do I update?



Output of gcc --version:



gcc (Ubuntu 5.3.1-14ubuntu2.1) 5.3.1 20160413
Copyright (C) 2015 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.

More From » software-installation

 Answers
7

You can install GCC 6 by adding the ubuntu-toolchain-r/test PPA. To do so, run the following commands:



sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-6


You can verify that gcc-6 is installed by running gcc-6 --version and the output should say gcc-6 (Ubuntu 6.1.1-2ubuntu12~16.04) 6.1.1 20160510.



As suggested by Mohamed Slama, if you want to further change the default GCC and G++ to the latest versions, install g++-6 with



sudo apt install g++-6


and then run



sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6    

[#14962] Thursday, August 26, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gliroopy

Total Points: 290
Total Questions: 115
Total Answers: 114

Location: Egypt
Member since Tue, May 3, 2022
2 Years ago
;