In this video, I'll take you through the steps necessary to install
a c++ compiler for the windows operating system.
We're going to install the compiler that's located at mingw-w64.org.
I'll provide this URL in the resources section for this video.
Open up your favorite browser,
and enter the URL mingw-w64.org,
and you'll get a website that might look like this.
Websites change over time,
but this is what it looks like as of march 2020.
What we want to do here is we want to click on downloads.
So I'm going to click on downloads,
and we've got a whole bunch of options here. What we're going to pick is this one,
right in the middle called mingw-w64 builds
for windows here.
And this is a cc++ and for trend compiler,
all built into one.It's a GCC compiler,
which is really a collection of compilers.
So what I'm going to do is I'm going to click that link right there
and then I get sent to this page, and finally, I'm going to go to SourceForge.
And when I go there, we're going to get the download. So I'm going to click on that.
And the download should happen automatically.
You can see here your download will start shortly.
Here's the download down here at the bottom of my chrome browser,
and it's done.
So at this point, you can see that I've got my mingw-w64 installer
ready to go.
You can see my antivirus just popped up a little message here that says that it's safe.
And what I'm going to do is I'm just going to double click on this to install it.
So in this case, I can come over here and select downloads,
and run it from here or I could run it down from the bottom. I'll just double click here.
I'm going to allow it to make changes to my system,
and I'm going to minimize my browser just to get it out of the way.
So this is the installation wizard right here.
It says welcome to the mingw-w64 installation.
Now the mingw compiler
will install a 32-bit compiler or a 64-bit compiler,
depending on your operating system.
So the first thing we need to do is
you need to see what kind of operating system you've got. Is it a 32-bit windows
operating system or a 64-bit windows operating system?
This really easy way to tell is just to come over here and
right in here,
we're going to type control panel,
and we're going to go to our control panel,
system and security,
and then right here where it says system, you can click on there,
and you can see right in the center here where it says system,
you can see that my system is a 64-bit operating system.
So I'm going to install the 64-bit compiler.
If yours says 32-bits, then you can install the 32-bit compiler.
And I'll show you how to do that in a second.
But this is important.
Make sure you remember this because when we install our CodeLight integrated development
environment in the next video, we're going to use this information again.
So write that down.
So I know I've got a 64-bit operating system. So I'm going to close this down now,
and I'm going to go through the installer. I'm going to select next.
And what I'm going to do here is I'm going to install the latest version.
You can click on here and get whatever version of the compiler you want.
I'm just going to stick to the latest which is 8.1.0 at the time of this video.
It might be 8.2, it might be 9.0 by the time
you download this,
the architecture. This is where the 32-bit,
64-bit comes to play.
So I'm going to click right there, and you can see
I-686 or x86_64.
This guy right here I-686, that's the 32-bit version.
That guy right there x-8664 is the 64-bit version.
That's what I'm going to choose.
Now if you're on a 64-bit machine,
it will definitely run the 32-bit version.
But you might as well use the 64 since you it's what you've got.
The rest of the stuff you just leave it alone, and I'm going to select next.
Now it's going to ask me where I want to put it.
I really don't like this huge long name that it's got here.
So what I'm going to do is I'm just going to erase that
and just take it all the way down to the mingw-w64 right,
mingw-w64 right about there.
Okay. So that's where I wanted to install my files.
It's very important once you when you name your directories to be sure
that you don't use any special characters, no international characters and no spaces.
So make sure that whatever you decide to use for directory names,
they're very very simple because compiler tool chains have
real problems with
cloud drives, spaces, international characters
and special characters.
I'd like to create a shortcut in the start menu, so I'm just going to select next.
And at this point, the installation is just going to go on its own,
just leave it alone take your time.
It doesn't take that long, probably just a couple of minutes.
And then once it's installed,
what we'll do is we'll do one more thing we need to do, we need to change our path variable
so that windows can find this.
Okay. So the installation is complete.
I'm going to select next, and finish, and we're done.
Now there's one more thing we want to do. We want to set
the path to what we just installed
in the windows path environment variable.
So how do you do that? Well, you go to control panel again,
and right up here in the search control panel,
I'm going to type env for environment and press enter,
and you'll see it says right here edit the system environment variables,
that's what I'm going to choose, now this is what you see
in windows 10.If you're running windows 7,
please refer to the resources section
for a pdf file that shows you how to do this there.
So I'm going to select edit the system variables right here.
And I get a systems property,
let me reduce this so it doesn't clutter up the screen.
Now down here at the bottom, there's a button called environment variables
that's what I'm going to select.
Now here are my environment variables. We've got variables for the user and system
variables. We could really do this in both places,
but I'm going to do it in the system variables area down here.
I'm going to select path, just like that.
And then I'm going to select edit.
Before you do anything here, be very, very careful not to delete anything.
We're not deleting anything in our path.
If we delete stuff in our path, we could really mess up our system.
So be very, very careful here.
I'm going to select edit, not delete, edit.
So I'm going to select edit
and I get a little screen like this.
Now these are my current path variables right here.
What I want to do is I want to add a new one
that points to what I just installed and I'll show you how to do that here.
We're going to select new
and right here, we're going to browse.
And I'm going to go to where this was installed
so it was installed in this PC
I was on the C drive it was in program files
and it was in mingw-w64. You see right there,
and what we're going to do here is we're going to select the bin directory,
that's the binaries. That's where all the executables are for the compiler.
So make sure that that's selected, click okay
and you can see that the path has been entered here.
Now what I like to do here is I like to move this up in the chain,
so I'm just going to select it and then move up
a few times just until it's just below the system 32 ones right here.
At that point, I'm done. I'll select okay. I'll select okay again.
And finally, okay one more time.
Now let's do a quick test to make sure that we installed this correctly and everything is running.
What I want to do is I just want to type
cmd here so I can get a command prompt
that will open up a window,
and this is your command prompt window. You can type commands in here.
So what we want to type in here is we want to type
g++ all lower case that lowercase g like that,
g++ followed by a space
and then -- version.
So again, g++ space -- version
and when I press enter, you should see something like this.
which is the version that we installed.
Now if you do g++ -- version, and you get something
that looks kind of like this,
some gobbledygook that says it's not recognized
as an internal or external command,
then what probably happened is that the path variable is not set correctly.
So back up, do that again, be real careful,
and make sure you selected that bin directory.
And that it's all good to go. So at this point,
we're good to go. Our compiler is installed.
The next step
is to install our CodeLight integrated development environment,
that's going to allow us to write c++ programs build them and
execute them. So I'll see you in that video next.