Hello and welcome back.
In this lecture, I'm going to show you how to install the C compiler for Windows.
This is required for the class.
You need a C compiler in order to write C programs.
The compiler that we're going to install is the GNU C, C compiler.
The reason we're installing this is because it's more portable and it allows you to write code from
the C 89 standard supports a lot of different features.
It allows us to use more advanced features as well.
So you need to install the GNU C c compiler.
Also, you're going to need to install the make utility and the GDB debugger.
We're going to download this from cygwin.com.
It basically simulates a Unix environment and that's what we're aiming for.
The GDB debugger is really useful for finding and fixing your errors.
So you need to download either the 32 or 64 bit version of the setup file which is cygwin.com install
dot html.
And then it just set up x 8664 set up x 8632 one of the two.
And so let me show you how to do that.
So here I have my Chrome browser.
I'm just going to type in.
Sig wind.com/install HTML.
You can also search for it if you want.
This is going to take you to the cygwin page and you're going to need to install download the setup.
So again, it's right here on the on the home page installing and updating cygwin for 64 bit version
of Windows or 32 bit versions.
You just select either the setup dash x86 or the setup dash x86 64 one of these two I have 64, so I'm
going to just click that.
When I click it, you have to download it.
I download it to my downloads directory.
And then once it's saved, you'll want to run that file so you can run it right in the browser once
it's done saving.
Once that's been downloaded, you can just double click on it and run it and you'll end up seeing something
like this.
And you can typically keep all the defaults the same.
So you can just hit next install from the internet is fine.
Hit next.
I install it in the C colon cygwin 64 directory.
You can change it if you want.
I usually keep all the defaults again hit next and then again defaults.
Direct connection.
I say next and then it will start downloading everything.
You can select a download site that best fits your location or just again keep it by default.
I'm going to keep default hit next and it's going to start downloading everything that we need.
So the next screen you're going to see is the select packages to install screen.
It's really important to understand that the screen may change.
So Cygwin comes out with different versions and they change things.
So what you really want to focus on is if there is no bin column, do not worry about it because some
of the newer versions may have been as default.
The main purpose is that you select that dropdown list and you make sure that a version is selected.
As long as a version is selected, it's showing up in the dropdown list, then that's going to be installed.
You don't have to worry about the check mark for the bin for newer versions.
Again, Cygwin comes out with all sorts of different versions.
So this, this graphical screen may look different based on what version it is.
Just make sure you have the dropdown list and that you actually select a version.
And as long as you have a selection and they don't say Skip, those are going to be installed.
You'll notice it has this big window with all these different packages.
We're going to only need to install three packages.
As I mentioned before, we're going to focus on GCC CORE, which is our compiler GDB, which is the
debugger and then the make utility.
First thing we want to do is we want to change the view to full and then we want to do is we want to
search for GCC dash core.
And here we'll see what we want to install.
And so the one we want to install here is GCC dash core.
We want to make sure that's checked and that we install that version.
The other version should say Skip.
So just make sure that it doesn't say Skip.
We also want to install GDB so we can search for GDB and in here we want to make sure we install GDB.
And again it shouldn't say skip, it should have the version number.
So we want to install this GDB version and really that's all the one we want to install.
You can install GDB four but that's not required.
So just select gdb, make sure that it doesn't say skip and that you have checked for binaries you don't
need to source and that will be the development category.
Last thing we want to check to install is our make so we can select make here.
And what we want to find is the make utility install which is right here make and we can say install
this with certain version.
We want to make sure it doesn't say Skip.
We can make sure it has a certain version number, the latest version checked and that is it.
All the other packages that are required will automatically be selected.
So then you can just select next to connect to the download site and these three packages will be installed.
So you just hit next and it will start asking you to review and confirm the changes.
And you just want to say next again.
After you're done installing, you're going to see this.
You can add a desktop icon if you need to or start menu.
I usually just leave them blank and then I hit finish.
And so your C installation is all done for your compiler.
Now you only have to do that for Windows.
The next step we need to do is we need to make sure our path is set up correctly.
This allows us to use the GCC binary anywhere in any directory.
So we're just going to bring up Windows Explorer.
We can hit the windows key and hit E, or we can go and bring it up from the start menu and this will
be our Windows Explorer box.
We can then go to this PC, we can go to our C drive.
This is where we installed our Cygwin environment.
So here we want to go to C and I installed it right in C Cygwin 64, so I'm going to select that.
I'm going to go to the binary directory, which is bin, I'm going to select bin and then I'm going
to copy the path for the bin directory so you can get the path right here at the top.
If you just select the arrow and then you can say right click or you can hit right click and say copy.
And then what you want to do is you want to go to your this PC right click and you want to go to properties.
And this is going to bring up your kind of control panel type thing for system security.
You want to hit advanced system settings, select that, and then from advanced system settings, we're
going to be able to set up our environment variables for our path.
So here we go to the bottom.
We just say environment variables.
We want to make sure we select the system variables here at the bottom, we want to go down and we want
to select the one that says Path.
Right here path and we want to say edit and then from edit, all we want to do is we want to add the
new one we just copied so we can say new.
And then we can say Ctrl V, or you can right click and say paste.
And this is going to add in our Cygwin 64 bin path.
And then you just say okay and say okay again and just keeping okay.
And once we have done that, we can verify that it worked by bringing up the DOS prompt.
So here we can just go to our Windows command and we can type in CMD and this will bring up the DOS
prompt.
First we want to do is we want to see if Cygwin was installed so we can use one of the binaries.
We can say sig check sig check dash C cygwin.
And this tells us that Cygwin was installed.
Status is okay, package is good.
Next we want to do is we want to check to make sure the C compiler was installed.
And to do this we can use a command GCC so we can say GCC and we'll just say dash dash version.
And this is going to tell us that we have GCC installed 7.4.0 and we're good to go and we have successfully
installed the C compiler.
Now, if this didn't work and you had any errors at all, for example, you might have typed in the
command and it said command not found.
That means that you didn't properly set up your path environment variable.
So you have to go back and do the step that I just did setting up that path environment variable so
that it points to the cygwin bin directory so that it can actually see the executables and run them.
So if you write Cygwin check and it says unrecognized command or if you try to do GCC unrecognized command,
you have to go back and fix your environment variable.
So we're good to go.
We installed the C compiler and again, we only have to do this for windows with a mac and Linux Linux
come with the C compiler.
With the Mac.
We will have to install some developer tools, but I'll show you how to do that in that lecture.
So the next few lectures we can, I'm going to show you how we can install other ides to work with the
C compiler.