this tutorial will show you how to
install the C and C++ compiler and tools
so that you can compile on your windows
7 windows 8 windows 8.1 and Windows 10
operating systems
this will focus mainly on the 64-bit but
will also work for 32-bit systems as
well so go ahead open up your browser
and in a new tab load this address right
here
scrolling down to installing and setting
up the compilers and tools next what
you're going to do is you're going to
open up a new tab and go to Cygwin.com
and then click on the install cygwin
next
you have a choice between installing
your 32-bit version or your 64-bit if
you want a 64-bit version please install
64 bit download the file I've already
got a copy downloaded and then once
it's downloaded double-click on the
setup run the setup click next install
from internet the root directory is fine
you can install it in program files this
does not lock you into place like some
applications do requiring you to install
only in the C:\ or only in the program
files I'm using all users choose your
preferences click Next just leave it as
local directory for now we're actually
going to move this folder when we
finally installed all the packages
necessary click Next i meanyes direct
connection because that's what i have
set up at the moment or you can change
your proxy choose any mirror doesn't
matter
click Next let it download after its
downloaded and installed and setup the
package window will look like the
following click on pending if you only
see pending you probably will see full
because i've already installed but you
haven't click on category and switch
back to your browser switch back to the
installing configuration URL
and then we're going to type in is "gcc-core"
so you can either copy and
paste that or type it in i'm going to go
ahead and type it in "gcc-core" and
then select default: change to install next we're
going to talk and just "c++" So "c++" same
thing before development install and
then we're going to type in "gdb" but what
you're going to do instead is you're
going to go to fool and type in "gdb" and
then you're going to find the "GNU Debugger" or
"gnu debugger" however you say
it and then makes you install it mine has
keep on it because i've already
installed but you should see the word
keep or sorry you should see the word
install next what you're going to type
in the word "make" and then scrolling down
to the work "make" just make nothing else
special so we have the word right here
"make" the GNU version of the make utility
so i'm going to put keep you'll want to
set up install on it and then go ahead
and click next and it will run through
about roughly between 5 and 15
minutes depending on your system for
installing the packages Do Not install
packages because that's roughly around
believe somebody said 8 GB on
the web and that's just ridiculous for
compiling C or C++ program so go ahead
and run through that next we're going to
do is we're going to set our global
environment variables so go ahead go
into your C directory and find where you
installed Cygwin\ then go in the bin\
directory copy the path to that
directory go to your system for your
advanced system variables I right-click
on my windows icon click on system
advanced system settings environment
variables and then under system
variables locate the path click Edit and
then notice I've already got mine set in
after my last which is my JD the jdk
installation and then go ahead and paste
in your in director for the cyclin at a
semicolon
click OK, click OK, click OK again and
then go ahead and close that out next
what you're going to want to do is
notice i have my setup dot x86 install
so from your downloads directory where
you have your install go ahead and cut
this and paste it right into this
directory do the same thing with that
mirror that we downloaded go ahead and
cut that and put that in here as well
the reason why you want the setup in
here is because the setup runs the same
way as an update those so anytime you
want to update anything you'll double
click and run through the set up and you
can update from there now that the
environment variables are set up
go ahead and close out cygwin64\ you can
hide your downloads it doesn't matter
i'm going to minimize my browser windows
actually sorry I'm gonna bring those
back up because now we're going to do is
we're scroll down and check to make sure
Cygwin has been installed you may have
to restart your computer and you may not
have to i'm actually using for my
command prompt which you're going to
have to load up is Cmder.net terminal
which is a syntax highlighting version
of the command console so go ahead and
load up your command console and then go
ahead and copy in the first one and
paste it and then run it and if you get
the version number you know you
installed correctly do the same thing
for the rest
and then once you're done go ahead and
clear that out now I'm going to show you
that you can compile it now that it's
proof that it's actually installed so
i'm going to change my directory to a
location where i have C files
we're going to actually run hello.c
so i'm using sublime text editor with
the see improved package installed for
that so it actually does additional
highlighting syntax and all its gonna do
is print "Hello World!" to the screen so go
ahead and type "gcc -o " and then the
name of the file you want to call it so
i'm gonna call it "hello" and then the
name of the actual file that we are
going to compile which is "hello.c"
oops
click on it
notice that we now have a "hello.exe"
added so we type
hello.exe "Hello World!"
thanks for watching
Không có nhận xét nào:
Đăng nhận xét