How to Install C++ Compiler on Linux?

There are several alternatives for compiling C++ on Linux. Let's look at 2 of them −


Almost all Linux distros come with GCC installed. Check whether GCC is installed on your system by entering the following command from the command line −

$ g++ -v

If you have installed GCC, then it should print a message such as the following −

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr .......
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

If GCC is not installed, then you will have to install it yourself using the detailed instructions available at 


Clang is a compiler developed by LLVM. You can install it using a freely available script on You can find the docs for it there. If not, you can download the prebuilt binary from and install it by following the install instructions.

Rishi Raj
Rishi Raj

I am a coder

Updated on: 10-Feb-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started