This post will guide you how to check if the gcc compiler or g++ compiler are installed on my ubuntu/CentOS/RHEL Linux system. How to check the location of the installed GCC compiler on Linux. HOw to install GNU c/c++ compiler (GCC and G++) on my Linux system.
Checking If GCC Compiler Is Installed
If you want to check if the GNU GCC Compilers are install on your system, you can try to check the version of GCC compiler on Linux, or you can use which command to locate gcc or g++ commands .
Check the Location of GNU or GCC Compiler
Type the following command to check the location of gcc compiler in your system, type:
$ which g++ $ which gcc $which make
Outputs:
devops@devops-osetc:~$ which gcc /usr/bin/gcc devops@devops-osetc:~$ which g++ /usr/bin/g++ devops@devops-osetc:~$ which make /usr/bin/make
Or you can use the type command to achieve the same result of checking the location of all compilers, type:
$ type gcc $ type g++ $ type make
Outputs:
devops@devops-osetc:~$ type gcc gcc is hashed (/usr/bin/gcc) devops@devops-osetc:~$ type g++ g++ is hashed (/usr/bin/g++) devops@devops-osetc:~$ type make make is hashed (/usr/bin/make)
Check Version of Compiler
if you want to check the version of All compilers installed on your Linux system, you just need to execute the following command:
$ gcc --version $ g++ --version $ make --version
Outputs:
devops@devops-osetc:~$ gcc --version gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 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. devops@devops-osetc:~$ g++ --version g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 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. devops@devops-osetc:~$ make --version GNU Make 4.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Installing GNU GCC Compiler
For CentOS/RHEL 6/7:
You need to execute the following yum command to install gcc compiler, type:
#yum groupinstall "Developent Tools"
Or
#yum group install "Development Tools"
For Ubuntu/Debian Linux:
you need to run the one of the following command to install compilers, type:
$ sudo apt-get install build-essential
or
$ sudo apt install build-essential