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
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.
The easiest way make
gcc-4.7
the defaultgcc
is to move the symlink of/usr/bin/gcc
:If you are looking for installation of old version of gcc, then install directly from command line. For instance if you want install gcc-4.4.6, and latest available version is 4.7.3. If you type:
then by default latest version will be installed. To install gcc-4.4.6, just type:
But still your default compiler is latest gcc. To remove latest gcc as default type:
Now making gcc-4.4.6 as default compiler (this is replacement of gcc by gcc-4.4.x), type:
Hope this will clarify above mentioned problem.
please follow this instruction: Build gcc (Here: version: 4.7.2)
Currently, the self-check of the gcc is not working, so this step is omitted here. Now you should check that the new compiler version 4.7.2 is called instead of the compiler used for the build process (here gcc-4.5.3). Enter the following commands:
The new compiler has been installed in
/usr/local/bin
. It is now the default compiler, because in the PATH variable/usr/local/bin
is before/usr/bin
.