How to Install C++ Compiler on Linux?

C++Object Oriented ProgrammingProgramming

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

GCC

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 https://gcc.gnu.org/install/. 

clang

Clang is a compiler developed by LLVM. You can install it using a freely available script on https://github.com/rsmmr/install-clang. You can find the docs for it there. If not, you can download the prebuilt binary from http://releases.llvm.org/download.html and install it by following the install instructions.

raja
Published on 15-Feb-2018 12:01:17
Advertisements