How can I use gcc 5.4 as default gcc command?

Viewed 303

I have installed both gcc and gcc-5 on my Ubuntu system, but I want to use gcc 5.4 as my default gcc command how can I do it?

As it can be seen:

~$ gcc-5 --version

gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010 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.

~$ gcc --version

gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 Copyright (C) 2017 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.

The problem actually has two sections:

  1. How can I install the exact version of gcc-5.4.0 ?

  2. How can I use gcc for this older version?

Even though I have two different versions of gcc in my system, I still cannot use the command: update-alternatives:

~$ update-alternatives --query gcc

update-alternatives: error: no alternatives for gcc

0 Answers
Related