1 00:00:05,300 --> 00:00:09,200 In this video, I'll take you through the steps necessary to install 2 00:00:09,200 --> 00:00:13,000 a c++ compiler for the windows operating system. 3 00:00:13,600 --> 00:00:19,600 We're going to install the compiler that's located at mingw-w64.org. 4 00:00:19,600 --> 00:00:23,400 I'll provide this URL in the resources section for this video. 5 00:00:24,200 --> 00:00:25,860 Open up your favorite browser, 6 00:00:25,860 --> 00:00:31,360 and enter the URL mingw-w64.org, 7 00:00:31,760 --> 00:00:34,760 and you'll get a website that might look like this. 8 00:00:34,760 --> 00:00:36,560 Websites change over time, 9 00:00:36,560 --> 00:00:40,220 but this is what it looks like as of march 2020. 10 00:00:40,820 --> 00:00:44,120 What we want to do here is we want to click on downloads. 11 00:00:44,620 --> 00:00:46,620 So I'm going to click on downloads, 12 00:00:46,620 --> 00:00:50,620 and we've got a whole bunch of options here. What we're going to pick is this one, 13 00:00:50,620 --> 00:00:54,920 right in the middle called mingw-w64 builds 14 00:00:54,920 --> 00:00:56,320 for windows here. 15 00:00:57,020 --> 00:01:00,010 And this is a cc++ and for trend compiler, 16 00:01:00,010 --> 00:01:03,670 all built into one.It's a GCC compiler, 17 00:01:03,670 --> 00:01:06,070 which is really a collection of compilers. 18 00:01:06,070 --> 00:01:09,370 So what I'm going to do is I'm going to click that link right there 19 00:01:10,170 --> 00:01:14,530 and then I get sent to this page, and finally, I'm going to go to SourceForge. 20 00:01:14,530 --> 00:01:18,630 And when I go there, we're going to get the download. So I'm going to click on that. 21 00:01:19,130 --> 00:01:21,830 And the download should happen automatically. 22 00:01:22,710 --> 00:01:25,590 You can see here your download will start shortly. 23 00:01:25,590 --> 00:01:29,390 Here's the download down here at the bottom of my chrome browser, 24 00:01:30,190 --> 00:01:31,190 and it's done. 25 00:01:31,790 --> 00:01:36,560 So at this point, you can see that I've got my mingw-w64 installer 26 00:01:36,560 --> 00:01:38,160 ready to go. 27 00:01:38,160 --> 00:01:42,760 You can see my antivirus just popped up a little message here that says that it's safe. 28 00:01:43,160 --> 00:01:46,960 And what I'm going to do is I'm just going to double click on this to install it. 29 00:01:47,460 --> 00:01:50,460 So in this case, I can come over here and select downloads, 30 00:01:50,460 --> 00:01:54,560 and run it from here or I could run it down from the bottom. I'll just double click here. 31 00:01:58,060 --> 00:02:00,720 I'm going to allow it to make changes to my system, 32 00:02:01,220 --> 00:02:04,320 and I'm going to minimize my browser just to get it out of the way. 33 00:02:04,320 --> 00:02:07,620 So this is the installation wizard right here. 34 00:02:07,620 --> 00:02:10,979 It says welcome to the mingw-w64 installation. 35 00:02:10,979 --> 00:02:13,000 Now the mingw compiler 36 00:02:13,200 --> 00:02:17,000 will install a 32-bit compiler or a 64-bit compiler, 37 00:02:17,000 --> 00:02:19,000 depending on your operating system. 38 00:02:19,000 --> 00:02:20,800 So the first thing we need to do is 39 00:02:20,800 --> 00:02:24,800 you need to see what kind of operating system you've got. Is it a 32-bit windows 40 00:02:24,800 --> 00:02:28,800 operating system or a 64-bit windows operating system? 41 00:02:28,800 --> 00:02:33,000 This really easy way to tell is just to come over here and 42 00:02:33,000 --> 00:02:34,500 right in here, 43 00:02:34,500 --> 00:02:36,300 we're going to type control panel, 44 00:02:37,300 --> 00:02:39,300 and we're going to go to our control panel, 45 00:02:40,800 --> 00:02:42,300 system and security, 46 00:02:43,180 --> 00:02:46,300 and then right here where it says system, you can click on there, 47 00:02:46,300 --> 00:02:49,500 and you can see right in the center here where it says system, 48 00:02:49,500 --> 00:02:53,100 you can see that my system is a 64-bit operating system. 49 00:02:53,500 --> 00:02:56,500 So I'm going to install the 64-bit compiler. 50 00:02:56,500 --> 00:03:00,700 If yours says 32-bits, then you can install the 32-bit compiler. 51 00:03:00,700 --> 00:03:02,260 And I'll show you how to do that in a second. 52 00:03:02,260 --> 00:03:03,760 But this is important. 53 00:03:03,760 --> 00:03:07,860 Make sure you remember this because when we install our CodeLight integrated development 54 00:03:07,860 --> 00:03:11,760 environment in the next video, we're going to use this information again. 55 00:03:11,760 --> 00:03:12,860 So write that down. 56 00:03:12,860 --> 00:03:17,160 So I know I've got a 64-bit operating system. So I'm going to close this down now, 57 00:03:17,860 --> 00:03:21,160 and I'm going to go through the installer. I'm going to select next. 58 00:03:22,060 --> 00:03:25,060 And what I'm going to do here is I'm going to install the latest version. 59 00:03:25,060 --> 00:03:28,060 You can click on here and get whatever version of the compiler you want. 60 00:03:28,060 --> 00:03:32,660 I'm just going to stick to the latest which is 8.1.0 at the time of this video. 61 00:03:32,660 --> 00:03:36,260 It might be 8.2, it might be 9.0 by the time 62 00:03:36,260 --> 00:03:37,860 you download this, 63 00:03:37,860 --> 00:03:40,460 the architecture. This is where the 32-bit, 64 00:03:40,460 --> 00:03:42,460 64-bit comes to play. 65 00:03:42,460 --> 00:03:45,260 So I'm going to click right there, and you can see 66 00:03:45,260 --> 00:03:49,860 I-686 or x86_64. 67 00:03:50,360 --> 00:03:54,460 This guy right here I-686, that's the 32-bit version. 68 00:03:55,460 --> 00:04:00,360 That guy right there x-8664 is the 64-bit version. 69 00:04:00,360 --> 00:04:01,760 That's what I'm going to choose. 70 00:04:01,760 --> 00:04:03,960 Now if you're on a 64-bit machine, 71 00:04:03,960 --> 00:04:06,260 it will definitely run the 32-bit version. 72 00:04:06,260 --> 00:04:09,360 But you might as well use the 64 since you it's what you've got. 73 00:04:09,360 --> 00:04:13,460 The rest of the stuff you just leave it alone, and I'm going to select next. 74 00:04:14,360 --> 00:04:16,350 Now it's going to ask me where I want to put it. 75 00:04:16,850 --> 00:04:19,850 I really don't like this huge long name that it's got here. 76 00:04:19,850 --> 00:04:22,250 So what I'm going to do is I'm just going to erase that 77 00:04:22,250 --> 00:04:25,450 and just take it all the way down to the mingw-w64 right, 78 00:04:25,450 --> 00:04:27,750 mingw-w64 right about there. 79 00:04:28,550 --> 00:04:31,320 Okay. So that's where I wanted to install my files. 80 00:04:32,620 --> 00:04:36,880 It's very important once you when you name your directories to be sure 81 00:04:36,880 --> 00:04:41,680 that you don't use any special characters, no international characters and no spaces. 82 00:04:41,680 --> 00:04:45,580 So make sure that whatever you decide to use for directory names, 83 00:04:45,580 --> 00:04:49,180 they're very very simple because compiler tool chains have 84 00:04:49,180 --> 00:04:50,780 real problems with 85 00:04:50,780 --> 00:04:54,440 cloud drives, spaces, international characters 86 00:04:54,440 --> 00:04:55,940 and special characters. 87 00:04:57,040 --> 00:05:00,640 I'd like to create a shortcut in the start menu, so I'm just going to select next. 88 00:05:02,840 --> 00:05:05,830 And at this point, the installation is just going to go on its own, 89 00:05:05,830 --> 00:05:08,030 just leave it alone take your time. 90 00:05:08,030 --> 00:05:11,390 It doesn't take that long, probably just a couple of minutes. 91 00:05:11,390 --> 00:05:13,390 And then once it's installed, 92 00:05:13,390 --> 00:05:17,590 what we'll do is we'll do one more thing we need to do, we need to change our path variable 93 00:05:17,590 --> 00:05:19,590 so that windows can find this. 94 00:05:24,590 --> 00:05:27,470 Okay. So the installation is complete. 95 00:05:28,770 --> 00:05:31,440 I'm going to select next, and finish, and we're done. 96 00:05:31,440 --> 00:05:34,440 Now there's one more thing we want to do. We want to set 97 00:05:34,440 --> 00:05:36,940 the path to what we just installed 98 00:05:36,940 --> 00:05:39,300 in the windows path environment variable. 99 00:05:39,300 --> 00:05:42,900 So how do you do that? Well, you go to control panel again, 100 00:05:44,450 --> 00:05:47,050 and right up here in the search control panel, 101 00:05:47,050 --> 00:05:51,650 I'm going to type env for environment and press enter, 102 00:05:52,250 --> 00:05:55,750 and you'll see it says right here edit the system environment variables, 103 00:05:55,750 --> 00:05:58,850 that's what I'm going to choose, now this is what you see 104 00:05:58,850 --> 00:06:01,850 in windows 10.If you're running windows 7, 105 00:06:02,150 --> 00:06:04,350 please refer to the resources section 106 00:06:04,350 --> 00:06:06,950 for a pdf file that shows you how to do this there. 107 00:06:06,950 --> 00:06:10,550 So I'm going to select edit the system variables right here. 108 00:06:11,550 --> 00:06:13,850 And I get a systems property, 109 00:06:13,850 --> 00:06:16,150 let me reduce this so it doesn't clutter up the screen. 110 00:06:16,750 --> 00:06:20,410 Now down here at the bottom, there's a button called environment variables 111 00:06:20,410 --> 00:06:21,910 that's what I'm going to select. 112 00:06:23,910 --> 00:06:27,910 Now here are my environment variables. We've got variables for the user and system 113 00:06:27,910 --> 00:06:29,930 variables. We could really do this in both places, 114 00:06:29,930 --> 00:06:33,290 but I'm going to do it in the system variables area down here. 115 00:06:33,290 --> 00:06:36,790 I'm going to select path, just like that. 116 00:06:37,340 --> 00:06:38,840 And then I'm going to select edit. 117 00:06:39,390 --> 00:06:44,190 Before you do anything here, be very, very careful not to delete anything. 118 00:06:44,440 --> 00:06:46,440 We're not deleting anything in our path. 119 00:06:46,440 --> 00:06:50,430 If we delete stuff in our path, we could really mess up our system. 120 00:06:50,430 --> 00:06:52,430 So be very, very careful here. 121 00:06:52,430 --> 00:06:55,520 I'm going to select edit, not delete, edit. 122 00:06:55,520 --> 00:06:56,880 So I'm going to select edit 123 00:06:58,180 --> 00:07:00,680 and I get a little screen like this. 124 00:07:00,680 --> 00:07:03,680 Now these are my current path variables right here. 125 00:07:04,340 --> 00:07:06,640 What I want to do is I want to add a new one 126 00:07:06,640 --> 00:07:09,940 that points to what I just installed and I'll show you how to do that here. 127 00:07:09,940 --> 00:07:11,540 We're going to select new 128 00:07:13,340 --> 00:07:15,640 and right here, we're going to browse. 129 00:07:17,640 --> 00:07:20,240 And I'm going to go to where this was installed 130 00:07:20,240 --> 00:07:22,240 so it was installed in this PC 131 00:07:22,640 --> 00:07:25,940 I was on the C drive it was in program files 132 00:07:26,140 --> 00:07:29,800 and it was in mingw-w64. You see right there, 133 00:07:30,000 --> 00:07:33,100 and what we're going to do here is we're going to select the bin directory, 134 00:07:33,100 --> 00:07:36,760 that's the binaries. That's where all the executables are for the compiler. 135 00:07:37,060 --> 00:07:39,860 So make sure that that's selected, click okay 136 00:07:40,360 --> 00:07:42,960 and you can see that the path has been entered here. 137 00:07:43,360 --> 00:07:47,020 Now what I like to do here is I like to move this up in the chain, 138 00:07:47,020 --> 00:07:49,720 so I'm just going to select it and then move up 139 00:07:50,420 --> 00:07:54,780 a few times just until it's just below the system 32 ones right here. 140 00:07:55,780 --> 00:08:00,180 At that point, I'm done. I'll select okay. I'll select okay again. 141 00:08:00,430 --> 00:08:02,430 And finally, okay one more time. 142 00:08:02,830 --> 00:08:07,130 Now let's do a quick test to make sure that we installed this correctly and everything is running. 143 00:08:07,530 --> 00:08:09,830 What I want to do is I just want to type 144 00:08:09,830 --> 00:08:12,830 cmd here so I can get a command prompt 145 00:08:13,430 --> 00:08:15,030 that will open up a window, 146 00:08:15,830 --> 00:08:19,160 and this is your command prompt window. You can type commands in here. 147 00:08:19,160 --> 00:08:21,360 So what we want to type in here is we want to type 148 00:08:21,360 --> 00:08:24,960 g++ all lower case that lowercase g like that, 149 00:08:25,460 --> 00:08:28,460 g++ followed by a space 150 00:08:28,460 --> 00:08:31,460 and then -- version. 151 00:08:32,559 --> 00:08:36,360 So again, g++ space -- version 152 00:08:36,360 --> 00:08:39,720 and when I press enter, you should see something like this. 153 00:08:43,919 --> 00:08:45,620 which is the version that we installed. 154 00:08:46,280 --> 00:08:50,580 Now if you do g++ -- version, and you get something 155 00:08:50,580 --> 00:08:52,130 that looks kind of like this, 156 00:08:52,130 --> 00:08:55,120 some gobbledygook that says it's not recognized 157 00:08:55,120 --> 00:08:57,420 as an internal or external command, 158 00:08:57,420 --> 00:09:01,920 then what probably happened is that the path variable is not set correctly. 159 00:09:01,920 --> 00:09:04,620 So back up, do that again, be real careful, 160 00:09:04,620 --> 00:09:07,120 and make sure you selected that bin directory. 161 00:09:07,370 --> 00:09:10,370 And that it's all good to go. So at this point, 162 00:09:10,370 --> 00:09:12,870 we're good to go. Our compiler is installed. 163 00:09:12,870 --> 00:09:14,270 The next step 164 00:09:14,270 --> 00:09:17,630 is to install our CodeLight integrated development environment, 165 00:09:17,630 --> 00:09:21,630 that's going to allow us to write c++ programs build them and 166 00:09:21,630 --> 00:09:24,130 execute them. So I'll see you in that video next.