Search Placementyogi.com
 

Getting Started With C (Environment Setup)

The very first thing you need to do is to have a compiler to compile and run the programs. So what is compiler? A compiler is a computer program that transforms source code written in a programming language into an executable that your computer can actually understand and run.

There are many c compilers available. Most frequently used and free available compiler is GNU C/C++ compiler. You can use Borland Turbo C or Microsoft Visual C++.

In following section we will discuss how to install GCC (GNU Compiler Collection) on various operating systems.

Installation on Linux/Unix Operating System

If you are using Linux/Unix then open command prompt and type below command to check gcc is installed or not?

gcc -v

Gives below output

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man …

Thread model: posix

gcc version 4.4.2 20091027 (Red Hat 4.4.2-7) (GCC)

If you get output similar to above then Congrats! GCC is already installed. Target value x86_64-redhat-linux indicates 64 bit and i386-redhat-linux indicates 32 bit.

If GCC is not installed then download latest version of GCC from website: http://gcc.gnu.org/install/ and follow the instruction given on this page.

How to compile and run program example

>gcc   hello.c  –o  hello       
>./hello                     
>hello   

Installation on Microsoft Windows

GCC for Windows is provided by two projects currently. They both provide a very own implementation of the Windows SDK (headers and libraries) which is necessary because GCC does not work with Visual Studio files.

  1. The older mingw.org, it provides only a 32-bit compiler. Download link Here
  2. The newer mingw-w64, which as the name predicts, also provides a 64-bit variant. Download link Here 

Download the latest version of the MinGW installation program, which should be named MinGW-<version>.exe and install it. Installation is very easy through GUI. While installing select C compiler and C++ compiler.

Default installation path is C:\MinGW.

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.

How to compile and run program example

c:\MinGW\bin>gcc  c://hello.c   -o   d://hello
c:\MinGW\bin>d://hello  
Hello  

Installation on Mac

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 https://developer.apple.com/technologies/tools/

 

 

Banner to LogicGuns.com

Hide Page Information

getting started with c environment setup gcc on linux window mac

Here you can find c environment setup with gcc on linux window mac

installation of gcc on linux, windows

In this section you can learn and about how the C language was developed by Dennis Richie and what languages helped in its evolution

Where can I get basic introduction about C?

Dennis Richeie Ken Thompson Martin Richards