How To Compile And Run a C/C++ Code In Linux

Iam a new Linux user and student who used to write C or C++ programs on MS-Windows. Now, I am using Ubuntu Linux. How can I compile a C or C++ program on Linux operating systems using bash Terminal application?

To compile a C or C++ program on any Linux distro such as Ubuntu, Red Hat, Fedora, Debian and other Linux distro you need to install:

  1. GNU C and C++ compiler collection
  2. Development tools
  3. Development libraries
  4. IDE or text editor to write programs

Step #1: Install C/C++ compiler and related tools

If you are using Fedora, Red Hat, CentOS, or Scientific Linux, use the following yum command to install best compiler for linux:
# yum groupinstall 'Development Tools'
If you are using Debian or Ubuntu Linux, type the following apt-get command to install GNU c/c++ compiler:
$ sudo apt-get update
$ sudo apt-get install build-essential manpages-dev

Sharing is caring!

Related Posts

Review of Windows Like Zorin OS Core 11

Latest issue of distrowatch weekly features a review of recently released Zorin OS Core 11, an Ubuntu 15.10 based GNU/Linux

Top 3 Best C/C++ IDE/Compilers For Various Platforms

C programming is the core of the programming knowledge. If you want to become a programmer than learning c is