Saturday, 18 April 2015

Installing/Upgrading GCC G++ 4.9 in Ubuntu/Linux Mint Machine

GCC GNU Compiler Collection is an open source command-line software designed to act as a compiler for GNU/Linux and BSD-based operating systems. It includes front-ends for numerous programming languages, including C, C++, Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages.

With GCC you can configure, compile and install GNU/Linux applications in Linux or BSD operating systems using only the source archive of the respective program. However, users don’t need to interact with the compiler, as this is done automatically by the configure and make scripts.

The latest update GCC 4.9.1 is a bug-fix release from the GCC 4.9 branch containing important fixes for regressions and serious bugs in GCC 4.9.0 with more than 88 bugs fixed since the previous release. In addition to that, GCC 4.9.1 release supports OpenMP 4.0 also in Fortran, rather than just in C and C++

Installing GCC 4.9

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update

sudo apt-get install gcc-4.9 g++-4.9

Once installed, run following commands one by one to use gcc 4.8 instead of previous version.

sudo update-alternatives --remove-all gcc 

sudo update-alternatives --remove-all g++

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20

sudo update-alternatives --config gcc

sudo update-alternatives --config g++

Now you can check the current version of gcc in your machine by giving the command

gcc --version

No comments:

Post a Comment