Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  13] [ 0]  / answers: 1 / hits: 32080  / 2 Years ago, tue, october 25, 2022, 10:45:11

I have gcc 4.6.3 installed:



gcc --version

gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3


I have installed newer version:



apt-get install gcc-4.7


But i still get result "gcc 4.6.3" when I type gcc --version. How to fix it?



I am using ubuntu 12.04 and i have done



sudo apt-get update
sudo apt-get upgrade

More From » 12.04

 Answers
6

This is because you have both versions installed, with 4.6 being treated as the default one.



You can explicitly choose which one to use.



$ gcc-4.7 --version
gcc-4.7 (Ubuntu/Linaro 4.7.2-22ubuntu4) 4.7.2
[...]

$ gcc-4.6 --version
gcc-4.6 (Ubuntu/Linaro 4.6.3-15ubuntu3) 4.6.3
[...]


The easiest way make gcc-4.7 the default gcc is to move the symlink of /usr/bin/gcc:



sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.7 /usr/bin/gcc

[#32158] Tuesday, October 25, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
montwim

Total Points: 103
Total Questions: 112
Total Answers: 120

Location: Vietnam
Member since Mon, Mar 14, 2022
2 Years ago
montwim questions
;