Skip to content

Instantly share code, notes, and snippets.

@alptugan
Created December 10, 2017 12:16
Show Gist options
  • Save alptugan/fd0a4fce9aa423eb1d62806c94677ca7 to your computer and use it in GitHub Desktop.
Save alptugan/fd0a4fce9aa423eb1d62806c94677ca7 to your computer and use it in GitHub Desktop.
execute in terminal :
gcc -v
g++ -v
Okay, so that part is fairly simple. The tricky part is that when you issue the command GCC it is actually a sybolic link to which ever version of GCC you are using. What this means is we can create a symbolic link from GCC to whichever version of GCC we want.
You can see the symbolic link :
ls -la /usr/bin | grep gcc-4.4
ls -la /usr/bin | grep g++-4.4
So what we need to do is remove the GCC symlink and the G++ symlink and then recreate them linked to GCC 4.3 and G++ 4.3:
rm /usr/bin/gcc
rm /usr/bin/g++
ln -s /usr/bin/gcc-4.3 /usr/bin/gcc
ln -s /usr/bin/g++-4.3 /usr/bin/g++
Now if we check the symbolic links again we will see GCC & G++ are now linked to GCC 4.3 and G++ 4.3:
ls -la /usr/bin/ | grep gcc
ls -la /usr/bin/ | grep g++
Finally we can check our GCC -v again and make sure we are using the correct version:
gcc -v
g++ -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment