Environment Setup for C Program

In this article, I’m gonna share you How to Setup Environment for C Programming. Keep reading this article till the end. I will share you C – Environment setup for both Unix/Ubuntu, Mac, and Windows OS.

C – Environment Setup

If you want to set up your environment for C programming language, you need the following two software tools available on your computer:

Text Editor or any IDE

Any text editor or IDE help to type C Programs. Ordinary Text Editors don’t have any extra features of typing C Programs so that you should use IDE for Coding purpose.

The files you create with your editor are called the source files and they contain the program source codes. The source files for C programs are typically named with the extension “.c”.

Before starting your programming, make sure you have one text editor in place and you have enough experience to write a computer program, save it in a file, compile it and finally execute it.

The C Compiler

The C Compiler is the special program that compile the Source code written by programmer into machine code so that your CPU can actually execute the program as per the instructions given.

The compiler compiles the source codes into final executable programs. The most frequently used and free available compiler is the GNU C/C++ compiler.

lets understand how to install GNU C/C++ compiler on various OS. We keep mentioning C/C++ together because GNU gcc compiler works for both C and C++ programming languages.

Installation on UNIX/Linux

If you are using Unix/Linux Operating System then check whether GCC is installed on your system by entering the following command from the command line:

If GNU compiler installed on your machine, then you will get the following output:


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.246)


If GCC is not installed, then  follow the commands step by step to install the GCC in Terminal:

sudo apt-get update

Dheeraj Patidar

This Command is used to keep updating all the packages which are already installed in computer system. 

Note: In this command it will ask for your password, make sure to enter the password correctly.

sudo apt install build-essential

Now we have to install the build-essential packages, which is also known as a meta-package, it contains the GCC compiler all the other essentials used to compile the software written in C and C++ language.

Dheeraj Patidar

gcc –version

This command is for verifying taht gcc have installed in your computer or not.

Dheeraj Patidar

Now, we have successfully installed the GCC on Linux.

Installation on Mac OS

If you use Mac OS X, the easiest way to obtain GCC is to download the Xcode development environment from Apple’s web site and follow the simple installation instructions. 

Once you have Xcode setup, you will be able to use GNU compiler for C/C++.

Xcode is currently available at developer.apple.com/technologies/tools/

Installation on Windows

To install GCC on Windows, you need to install MinGW. To install MinGW, visit www.mingw.org.

Download the latest version of the MinGW installation program, which should be named MinGW-<version>.exe.

While installing Min GW, at a minimum, you must install gcc-core, gcc-g++, binutils, and the MinGW runtime, but you may wish to install more.

Add the bin subdirectory of your MinGW installation to your PATH environment variable, so that you can specify these tools on the command line by their simple names.

After the installation is complete, you will be able to run gcc, g++, ar, ranlib, dlltool, and several other GNU tools from the Windows command line.


This is all about GCC installation in various Operating Systems. If you have any confusion then visit receptive official website of Installation and help.

I hope you enjoy this article.

Thanks for visit!

< Previous Post

  Next Post >

Leave a Reply

Your email address will not be published. Required fields are marked *