in our previous lesson we wrote and
executed our first 'C' program.
We printed hello world on screen .We used gcc compiler which runs from command
line to compile our program
now in this lesson we will see how we
can use
compiler that we call integrated
development environments or IDEs
to write compile and
execute our program. IDEs give you
a rich editor, a nice user interface
and a bunch of features that help you
manage big projects
and detect errors in your program. Some of
the IDEs that you can use for C are
DEV-CPP, this is a
light one. There is another one named
Code Blocks
Visual Studio Express edition. This one
is by Microsoft and this is what
I will use in most of the lessons in this
series
there is another one named Eclipse for
C/ C++
typically an IDE would support both
C and C plus plus
I D E and compiler, you can use these terms
for each other
that's what we do practically. There is
one more thing that I want to point out
it's good if your compiler follows the
latest
standards for C language. There are some
compilers that are
too outdated like Turbo C
I would not recommend using this.
You can use any among the rest.
I will come back to showing how you can
use some of these IDEs
but first I'll open the program that we
had written in our previous lesson
A compiler takes a C source file, a compiler
for C will take a C source file and create
an executable file. if there is a
syntactical
error in your program , compilation fails
compiler gives  you error messages
that we call compilation errors.
compilation errors should help you fix
your program
for example it's a rule that every
statement in C must end with a semicolon
let's remove this semicolon from here and
now lets compile this file using gcc
to compile we would give gcc space the
C source file name, Now as you can see I am getting some error message here.
It's saying that in function
int main(),  at line 6, a semi-colon is
expected.
if I would fix this error put a
semicolon at the end of this printf
statement
save the file and then
compile again there is no error. If
there would be a compilation
error no fresh executable file will be
created
if compilation passes, an executable file
named
a.exe will be created afresh.
you can run this executable file from
command line
if you would like to give your executable file
a name of your choice
in gcc, while using gcc, what you can do is
you can type in gcc source file name
space
minus O and then you type in
the name that you want for executable.
For example let's say I want
HelloWorld.exe, then I'll just say HelloWorld
With this and executable file named HelloWorld.exe is created
you can check it from command line also, type in
DIR to list all the files in the
directory and now you can run
HelloWorld.exe
please note that I am wanna bindles
machine things will be pretty similar
on a Linux machine you would not have a
fight he
with extension expe you would have a
fight with extension
out so you can create something like
Hello void
doc out now the even see how we can come
by I'll and execute
our program in some of these ID ease the
village secured the scene program to
print hello world
I have opened up Dave CPP on what feels
like I def c plus plus compiler
I would recommend watching this part of
to be due in full screen for
Becca Plata de now the first thing that
we need to do is
we need to create a/c source file and
this time
we do not need to use an external editor
like Notepad
go to File in the menu at the top here
then new
and click on source file you also have
pushed a keyboard shortcut for this
and it'll open and editor for you in the
ided itself where you can type in your
court
and read the same program to print hello
world on screen
this time they're getting these nice
color courts
as you can see these keywords: in Denver
tonight in Boyd this forced languages
celebrity defense
is in some other color the skull of
course
improve third ability of your program
now the next thing that we need to do is
need to save dis source file to see if
he did press control plus
S key gonna go to File antique on Save
or Save As
this dialogue will open into struck down
save this tape
select see source file and then give a
name for the source file and give named
Dave CPP hello
once I click on save my C++ source file
is created
now I can come by on my program to
comply
go to execute in the menu at the top
here
and click on compile you also have a
keyboard shortcut control
plus f9 key for this when you were taken
compiled this
pop-up will come and if everything is
alright and executed will be created in
the scene for reader
where you would have saved your source
file the name of the executable will be
seen as the name of the source fired so
if my
source file is Dave CPP hello dart see
my executable is
Dave CPP hello doc expe
as fear teen million weekend double
click this executed by then try to run
the program
but something will flash and gore made
the machine will start and finish the
execution of program in no time
if you want to see the output you can
run the executable from command line
go to the folder where they execute a
bill is from the command line
and type in the name of the executable
file so this may be able to see the
output
die idee also gives you option to fund
the program
you can go to execute and second run
there is a
keyboard checkered control plus f10 for
this bike
this is same as double clicking the
executable file something will flash and
go away quickly
the program the start and finish its
execution
in no time before you can see the output
to see the output of program by double
clicking on the executors Bernard by
using
this an option in the menu here we can
put
hacked in our program so what I'm going
to do here it is
am first going to right are comment in
my program if you would write the line
in your program
starting with two forward slashes
backline
is a comment in your program it will be
ignored by the compiler
when compiling it will not be considered
a valid see statement
it will not be considered a/c statement
to be executed
and now I'll draped to see statements
these two statements you're saying that
the program
must de Cannes integer as input from the
user
so when you would run the program the
program bill wait for you to enter an
integer
let's compile and run discord and see
what happens
compilation a successful and now i cant
run
as you can see this console display has
come here
earlier it would come and go in no time
now because it's waiting for you to
input some integer
it's there and you can see hello world
on screen
if I would press any key on the keyboard
now and press
enter the console Rico a mi
some ladies automatically paused
execution of your program
in the end and show you the output so
you do not have to put
a hack like this Dave c plus plus
doesn't do that
and always remember that this is a hack
different people put different kind of
hacks
some people use a function named gets
%eh which is sparked off on your doc
it's like Betty this function gets %eh
will make your program feet
I did you pass some key but call your
doc it is not
a standard celebrity it will not be
supported by many come by a nurse
so it is not clear commended if you
would have some
editing your program then upon combining
you would get the editor
and I D E let's remove the semi-colon
here and try to combine the program and
see what happens
it would be this month for you to see it
saying they act at line 5 there we have
it done statement
dead is a syntex better before this line
as a Newbie as a big a nerd in
programming accomplish in it and would
often scare you
it's important that you read the entire
message carefully and try to
see a program and fixed our completion
at Ash
if I would produce come arsenic on here
is my program would combine successfully
than it would go away
So Def CPB is fine after I D E stacked
you can use
if you would use other eighties things
will be almost similar
I have opened up another ninety you
named cord blocks
things are similar hand go to File new
and click on empty fine this time before
writing court I would first to see if
the file
child Press control s the style love
will come Save as type as selected
CC plus plus fines and then I'll give a
name
court blocks hello doxie
1 seconds here I can take my program
not to compile I can go to be in the
menu at the top here
and I can click on BB and come by Liza
synonyms may use these two tones for
each other
if you build a successful nor message
will come you can run the program
you can also used option base and run it
we do both
in one take side took one bed and run
now cord block
all service causes the console for you
to see the output
and once you learn press any key Denali
the console exit as you can see it's
printing some extra messages apart from
what you have continued called
this definitely is better because fear
not having to put the hack
so I have shown you how they can work
with two of 2i
the East things will be almost similar
if you would use any other baby
some web-sites including arson give you
this feature
that you can't write compile and view
the output of your program
in their browser itself so you do not
have to install anything on your local
machine
links to all of these resources to i'm
talking about. can be found in the
description of this video
from Nixle SNB will start getting deeper
into C language concepts
this is it for this lesson thanks for
watching
