I want to install the latest gcc
package (7.1) on Xubuntu 16.04.4. I have successfully installed the package following the instructions given here from GAD3R.
The problem is that when I run:
gcc --version
I get the following output:
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
which means that my OS doesn't see the newly installed gcc
as the default compiler. How can I achieve that?
Furthermore, I you have a more trusty source than the one presented in the link, please feel free to add it.
Regards
AFAIK the toochain-r PPA that you used is the recommended source for alternate versions of GCC. To make it the default, you can either use the update-alternatives mechanism as explained in this previous Q&A
How to use multiple instances of gcc?
or by direct symlinking as described in
Downloaded g++ 4.8 from the PPA but can't set it as default?
Although in practice it's often not necessary, since most build systems allow you to specify a particular compiler, either using command-line arguments or environment variables e.g.
or
or
-- see for example CMake Useful Variables.
You can use update-alternatives to make it default:
For instance, this Dockerfile gives you Ubuntu 16.04 with gcc 7: