I am using Ubuntu 14.04 LTS. I want to install latest version of GCC 4.9.0. Is it possible to uninstall default GCC compiler prepacked with OS?

In this link, I read that uninstalling the default compiler may lead to stability issues Since I am planning to install the latest version, will that cause stability issue?

And another problem is that in the official GNU GCC page, I read that GCC supports compiling of c++ programs. But I couldn't compile a program using gcc. So, I used g++. By using g++ instead of GCC, It gave an error stating that g++ is not installed. Wouldn't Ubuntu come along with g++ or is there any other config to use g++ with GCC?

  • Running sudo apt-get install g++ will install g++ 4.8. – saiarcot895 Jun 17 '14 at 12:13
  • I have downloaded the source tarball of GCC 4.9.0 from ftp server of gnu site. Is there a way to replace the existing gcc using this tarball file? – sapphirebox001 Jun 18 '14 at 3:31

You will need to build from sources gcc-4.9 (latest version is 4.9.1), here is a good, step by step, description of how to build and install gcc-4.9.1 on Ubuntu 14.04:


A short resume of what you need to do, please check the above link for more details:

  • Install build-essentials, gawk, m4, gcc-multilib
  • Download the source code for GMP, MPC, MPFR, GCC
  • Build and install them in this order (see the link for details):
    • GMP
    • MPFR
    • MPC
    • GCC

After that you should be able to invoke gcc-4.9.1, g++-4.9.1 and gfortran-4.9.1 from the Terminal.

| improve this answer | |
  • Hello, thanks for you answer. Please have a look at the link I've posted, basically it is an entire article. Do you want me to copy/paste this article here ? – JeanC Aug 27 '14 at 13:23
  • No, just telling the essential parts is fine - which you probably did in the meantime. – guntbert Aug 27 '14 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.