How to install latest stable release of GCC in Linux Mint?
Your Linux Mint comes pre-installed with a GCC package. So first I would recommend you to check if the package is already present in your system by typing the following command in terminal.
apt-cache search gcc
In case you're not having any such package then use the following command in terminal firstly you've add the following repository:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
then use the next command:
sudo apt-get update
sudo apt-get install g++-4.7 c++-4.7
There is always basic thing we should learn; take it as prerequisite before linux.. Learn googling... try to do more hard search ...
download the latest version of gcc
wget http://www.netgull.com/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.bz2
use command: tar -xjf
to unzip the file
Enter the directory that you unzipped just now, say in $HOME/Downloads/gcc-5.3.0
, then type command:
./configure --disable-checking --enable-languages=c,c++,objc
--disable-multilib --with-system-zlib prefix=/usr/bin/gcc-5.3
Dependency installation:build GCC requires GMP4.2+, MPFR 2.4.0+, and MPC 0.8.0+ and build essential
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev libc6-dev
sudo apt-get install build-essential
install a C++ compiler
sudo apt-get install g++
Next type:
make
sudo make install
Edit if you still get errors message like " zlib.h not found!" you can do the below to fix it:
apt-get install zlib1g-dev
I am not quiet sure what should be the lastest, because there are always some latest comes out. But you can install any of them in this way.
Take gcc-8 as example:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-8 g++-8
gcc-8 --version
if you want to select gcc-8/g++-8 with higher priority(20 in this case), you also need to
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 20 --slave /usr/bin/g++ g++ /usr/bin/g++-8