C Environment Setup PDF
C Environment Setup PDF
CEnvironmentSetup
CEnvironmentSetup
Advertisements
WEB
HOSTING
PreviousPage
NextPage
TryitOptionOnline
WehavesetuptheCProgrammingenvironmentonline,sothatyou
can compile and execute all the available examples on line. It gives
youconfidenceinwhatyouarereadingandenablesyoutoverifythe
programswithdifferentoptions.Feelfreetomodifyanyexampleand
executeitonline.
Try the following example using our online compiler available at
CodingGround.
#include<stdio.h>
intmain(){
/*myfirstprograminC*/
printf("Hello,World!\n");
return0;
}
Formostoftheexamplesgiveninthistutorial,youwillfindaTry it
option in our website code sections at the top right corner that will
takeyoutotheonlinecompiler.Sojustmakeuseofitandenjoyyour
learning.
LocalEnvironmentSetup
IfyouwanttosetupyourenvironmentforCprogramminglanguage,youneedthe
http://www.tutorialspoint.com/cprogramming/c_environment_setup.htm
1/4
3/24/2016
CEnvironmentSetup
following two software tools available on your computer, (a) Text Editor and (b)
TheCCompiler.
TextEditor
Thiswillbeusedtotypeyourprogram.ExamplesoffewaeditorsincludeWindows
Notepad,OSEditcommand,Brief,Epsilon,EMACS,andvimorvi.
Thenameandversionoftexteditorscanvaryondifferentoperatingsystems.For
example,NotepadwillbeusedonWindows,andvimorvicanbeusedonwindows
aswellasonLinuxorUNIX.
Thefilesyoucreatewithyoureditorarecalledthesourcefilesandtheycontainthe
programsourcecodes.ThesourcefilesforCprogramsaretypicallynamedwiththe
extension".c".
Beforestartingyourprogramming,makesureyouhaveonetexteditorinplaceand
youhaveenoughexperiencetowriteacomputerprogram,saveitinafile,compile
itandfinallyexecuteit.
TheCCompiler
The source code written in source file is the human readable source for your
program.Itneedstobe"compiled",intomachinelanguagesothatyourCPUcan
actuallyexecutetheprogramaspertheinstructionsgiven.
Thecompilercompilesthesourcecodesintofinalexecutableprograms.Themost
frequentlyusedandfreeavailablecompileristheGNUC/C++compiler,otherwise
you can have compilers either from HP or Solaris if you have the respective
operatingsystems.
The following section explains how to install GNU C/C++ compiler on various OS.
WekeepmentioningC/C++togetherbecauseGNUgcccompilerworksforbothC
andC++programminglanguages.
InstallationonUNIX/Linux
If you are using Linux or UNIX, then check whether GCC is installed on your
systembyenteringthefollowingcommandfromthecommandline
$gccv
IfyouhaveGNUcompilerinstalledonyourmachine,thenitshouldprintamessage
asfollows
http://www.tutorialspoint.com/cprogramming/c_environment_setup.htm
2/4
3/24/2016
CEnvironmentSetup
Usingbuiltinspecs.
Target:i386redhatlinux
Configuredwith:../configureprefix=/usr.......
Threadmodel:posix
gccversion4.1.220080704(RedHat4.1.246)
If GCC is not installed, then you will have to install it yourself using the detailed
instructionsavailableathttp://gcc.gnu.org/install/
ThistutorialhasbeenwrittenbasedonLinuxandallthegivenexampleshavebeen
compiledontheCentOSflavoroftheLinuxsystem.
InstallationonMacOS
If you use Mac OS X, the easiest way to obtain GCC is to download the Xcode
developmentenvironmentfromApple'swebsiteandfollowthesimpleinstallation
instructions.OnceyouhaveXcodesetup,youwillbeabletouseGNUcompilerfor
C/C++.
Xcodeiscurrentlyavailableatdeveloper.apple.com/technologies/tools/
InstallationonWindows
ToinstallGCConWindows,youneedtoinstallMinGW.ToinstallMinGW,gotothe
MinGWhomepage,www.mingw.org
,andfollowthelinktotheMinGWdownload
page.DownloadthelatestversionoftheMinGWinstallationprogram,whichshould
benamedMinGW<version>.exe.
While installing Min GW, at a minimum, you must install gcccore, gccg++,
binutils,andtheMinGWruntime,butyoumaywishtoinstallmore.
Add the bin subdirectory of your MinGW installation to your PATH environment
variable,sothatyoucanspecifythesetoolsonthecommandlinebytheirsimple
names.
Aftertheinstallationiscomplete,youwillbeabletorungcc,g++,ar,ranlib,dlltool,
andseveralotherGNUtoolsfromtheWindowscommandline.
PreviousPage
NextPage
Advertisements
http://www.tutorialspoint.com/cprogramming/c_environment_setup.htm
3/4
3/24/2016
CEnvironmentSetup
Writeforus
FAQ's
Helping
Contact
Copyright2016.AllRightsReserved.
Enteremailfornewsletter
http://www.tutorialspoint.com/cprogramming/c_environment_setup.htm
go
4/4