1 00:00:05,150 --> 00:00:07,350 Welcome back. In this video, 2 00:00:07,350 --> 00:00:11,150 we're going to configure the CodeLite IDE that we just installed in the 3 00:00:11,150 --> 00:00:13,850 previous video to work on windows 4 00:00:13,850 --> 00:00:16,730 with the c++ compiler that we installed. 5 00:00:16,730 --> 00:00:19,730 If you haven't installed the c++ compiler, 6 00:00:19,730 --> 00:00:23,990 please go back to that video and install it because we're going to have to need it installed 7 00:00:23,990 --> 00:00:25,290 in order to continue. 8 00:00:25,290 --> 00:00:28,060 So the first thing I want to do is I want to run CodeLite. 9 00:00:28,060 --> 00:00:31,960 Now I've got an icon here right on my desktop. so I'm just going to double click on that. 10 00:00:32,509 --> 00:00:34,810 Now this is the first time I run CodeLite, 11 00:00:34,810 --> 00:00:37,710 and a lot of stuff happens. You get to set up wizards, 12 00:00:37,710 --> 00:00:40,370 you may get this little message at the bottom that says 13 00:00:40,370 --> 00:00:42,670 CodeLite now offers a better editor. 14 00:00:42,670 --> 00:00:45,470 So what I want to do is I want to close this wizard. I'm going to run that 15 00:00:45,470 --> 00:00:46,570 manually in a moment. 16 00:00:46,570 --> 00:00:47,930 So let's cancel that, 17 00:00:48,630 --> 00:00:51,530 and let's select yes down here, 18 00:00:51,530 --> 00:00:54,530 so CodeLite can update our themes. 19 00:00:54,530 --> 00:00:56,030 so I'm going to select ye, 20 00:00:57,030 --> 00:01:01,290 and it says CodeLite restart is needed would you like to restart it now? Yes, 21 00:01:01,290 --> 00:01:03,290 and CodeLite will restart really quickly. 22 00:01:03,290 --> 00:01:06,590 You may or may not get that message depending on 23 00:01:06,590 --> 00:01:10,490 what the CodeLite developers do in the future.So now we're good. 24 00:01:10,490 --> 00:01:12,090 CodeLite is running. 25 00:01:12,090 --> 00:01:14,690 You can see that there's a lot of empty space here. 26 00:01:14,690 --> 00:01:16,350 We've got a workspace view here. 27 00:01:16,350 --> 00:01:18,650 We've got this big old space here in the center, 28 00:01:18,650 --> 00:01:20,950 and I'll explain what all of this is 29 00:01:20,950 --> 00:01:24,150 in a future video I'm going to do a walkthrough of CodeLite 30 00:01:24,150 --> 00:01:25,750 of the entire interface. 31 00:01:25,750 --> 00:01:29,410 But for now what we're going to do is we're just going to get it set up and configured. 32 00:01:29,410 --> 00:01:31,710 So the first thing we need to do is 33 00:01:31,710 --> 00:01:34,920 we need to run that setup wizard the one that I just cancelled. 34 00:01:34,920 --> 00:01:36,520 so I'm going to come up here to help 35 00:01:37,180 --> 00:01:39,840 and I'm going to select run the setup wizard. 36 00:01:39,840 --> 00:01:42,640 Again, help, run the setup wizard. 37 00:01:44,180 --> 00:01:47,480 And I get this little dialog box that says welcome to the setup wizard. 38 00:01:48,680 --> 00:01:53,040 I do want to run it. You only need to do this once, so I'm going to do it first time right now. 39 00:01:53,040 --> 00:01:54,340 I'm going to select next. 40 00:01:55,640 --> 00:01:58,440 Now it's going to ask me about my development profile. 41 00:01:58,990 --> 00:02:01,790 The CodeLite IDE supports web development with 42 00:02:01,790 --> 00:02:03,790 PHP and JavaScript 43 00:02:03,790 --> 00:02:05,790 as well as c++ development. 44 00:02:06,190 --> 00:02:08,490 So if you do both, you can select both over here. 45 00:02:08,490 --> 00:02:12,890 I'm only going to select cc++ development right here this option, 46 00:02:13,090 --> 00:02:14,390 and I'm going to select next. 47 00:02:15,490 --> 00:02:18,050 Now it says you want to set up a compiler. 48 00:02:18,050 --> 00:02:21,150 I don't want to install a compiler. I've already installed it, 49 00:02:21,150 --> 00:02:23,650 so what I want to do is select scan. 50 00:02:23,650 --> 00:02:27,310 What CodeLite will do is it'll scan my system for installed 51 00:02:27,310 --> 00:02:30,310 compilers and set them up for me automatically. 52 00:02:30,910 --> 00:02:34,010 It's important that we set that path variable. 53 00:02:34,010 --> 00:02:36,340 Remember when we installed the compiler, 54 00:02:36,340 --> 00:02:39,740 CodeLite uses that path variable to find the compiler. 55 00:02:39,740 --> 00:02:43,940 So if we scan and it can't find the compiler either it's not installed 56 00:02:43,940 --> 00:02:47,300 or the path variable is incorrect. So I'm going to select scan, 57 00:02:48,500 --> 00:02:52,700 and you see it found my mingw-w64 compiler that I installed, 58 00:02:52,700 --> 00:02:56,300 and you can see the installation path. I'll select next, 59 00:02:57,960 --> 00:02:58,560 that's it. 60 00:02:58,560 --> 00:03:00,860 Now we're going to customize our colors. 61 00:03:00,860 --> 00:03:03,220 You can use the system default or you can use the dark. 62 00:03:03,220 --> 00:03:05,820 The dark is pretty nice and easy on the eyes, 63 00:03:05,820 --> 00:03:08,020 but I don't think it shows up too good on video. 64 00:03:08,020 --> 00:03:11,020 So I'm going to stick to the system default for the video, 65 00:03:11,020 --> 00:03:12,220 and select next. 66 00:03:13,580 --> 00:03:18,480 These settings here for spacing and indentation just leave those as the default 67 00:03:18,680 --> 00:03:20,180 and select finish. 68 00:03:21,680 --> 00:03:22,280 Okay. 69 00:03:22,980 --> 00:03:24,980 It's going to close and restart, 70 00:03:25,580 --> 00:03:28,180 and we're going to get the same interface again. 71 00:03:28,180 --> 00:03:31,280 Now we want to double check that the compiler was set up correctly. 72 00:03:31,280 --> 00:03:35,780 So we want to go to settings, and then select build settings, 73 00:03:36,880 --> 00:03:41,030 and you should see mingw-w64 here when you select 74 00:03:41,030 --> 00:03:44,330 the compilers tab, and you should see all the paths to the 75 00:03:44,330 --> 00:03:47,690 compiler the link or the assembler. All this good stuff that we'll talk about later. 76 00:03:48,290 --> 00:03:50,490 Okay. If this is all empty, 77 00:03:50,490 --> 00:03:52,790 then the compiler was not set up correctly. 78 00:03:52,790 --> 00:03:56,090 And you really need to go back and double check that path variable. 79 00:03:56,090 --> 00:03:59,090 Okay. So at this point, we're good to go. 80 00:03:59,090 --> 00:04:02,990 We're done with the installation and the setup of the compiler. 81 00:04:03,390 --> 00:04:06,090 Now what we're going to do is we're going to write a real simple 82 00:04:06,090 --> 00:04:09,290 program just to be sure that all of this is working correctly. 83 00:04:10,170 --> 00:04:14,270 So the first thing we want to do is we want to create a new workspace. 84 00:04:14,270 --> 00:04:17,630 And I can create that right here I can click on new workspace 85 00:04:17,630 --> 00:04:20,529 or I can come up here and say workspace, 86 00:04:20,529 --> 00:04:23,630 new workspace other place. Now the idea behind a workspace 87 00:04:23,630 --> 00:04:27,290 is workspace is an area and it holds projects. 88 00:04:27,290 --> 00:04:31,390 So we can have a single workspace that contains many projects 89 00:04:31,390 --> 00:04:34,590 and that's the way that I've set up the source code for this course. 90 00:04:34,590 --> 00:04:38,490 The source code is located in the very last section of the course, 91 00:04:38,490 --> 00:04:41,040 and it's organized into workspaces. 92 00:04:41,040 --> 00:04:43,840 So you can download workspace for section 5, 93 00:04:43,840 --> 00:04:47,340 and it's going to have all the projects that I did for section 5. 94 00:04:47,340 --> 00:04:50,240 It's a very nice way to organize projects. 95 00:04:50,240 --> 00:04:55,230 So again, it's just a basically an area where you can have different c++ projects. 96 00:04:55,230 --> 00:04:58,780 So let's do that. I'm going to select new workspace, 97 00:04:59,680 --> 00:05:01,780 and the first thing it asks me is 98 00:05:01,780 --> 00:05:06,280 what kind of workspace.Is it a file system workspace or a c++ workspace? 99 00:05:06,280 --> 00:05:10,380 I'm going to select c++ workspace, and click okay. 100 00:05:11,280 --> 00:05:15,510 Now it's going to ask me where do I want to store it and what's the name of my workspace? 101 00:05:15,510 --> 00:05:18,510 Well, I'm going to store it in my documents folder, 102 00:05:19,410 --> 00:05:21,610 and I'm going to call the workspace 103 00:05:22,610 --> 00:05:25,600 FirstWorkspace. 104 00:05:26,960 --> 00:05:31,160 Okay. Now I strongly urge you to click that to check 105 00:05:31,160 --> 00:05:34,460 this little box right here, which says create the workspace under a separate 106 00:05:34,460 --> 00:05:37,960 directory that'll really help you keep your files organized, 107 00:05:37,960 --> 00:05:39,350 so you can see what's going to happen, 108 00:05:39,350 --> 00:05:43,650 it's going to generate a file called firstworkspace.workspace, 109 00:05:44,150 --> 00:05:48,750 and it's going to be in this FirstWorkspace directory, which is exactly what we want. 110 00:05:49,150 --> 00:05:51,450 I'm now -- there's a word of caution here, 111 00:05:51,450 --> 00:05:53,750 do not use spaces here, 112 00:05:53,750 --> 00:05:57,950 do not use special characters like pluses. I mean don't do like 113 00:05:57,950 --> 00:06:02,150 something like c++ workspace that's going to cause all kinds of problems. 114 00:06:03,050 --> 00:06:06,750 No international characters, no spaces. 115 00:06:07,250 --> 00:06:09,750 So keep the naming very, very simple. 116 00:06:10,650 --> 00:06:12,350 If your username -- for example, 117 00:06:12,350 --> 00:06:14,150 my username here is Frank. 118 00:06:14,150 --> 00:06:18,950 If your username has special characters or international characters, 119 00:06:18,950 --> 00:06:22,450 then don't use it, create this somewhere like 120 00:06:22,450 --> 00:06:25,050 CPP or somewhere else. 121 00:06:25,050 --> 00:06:29,050 Create it in a folder that doesn't have all of that in it. Okay. 122 00:06:29,050 --> 00:06:33,250 The last thing is finally be very aware that these compiler 123 00:06:33,250 --> 00:06:37,850 tool chains which is what we're using are very very picky about names. 124 00:06:38,350 --> 00:06:40,550 Don't store these on cloud drives, 125 00:06:40,550 --> 00:06:44,650 like google drive or DropBox or OneDrive. 126 00:06:44,650 --> 00:06:48,980 They can cause a lot of issues. So again, store stuff locally. 127 00:06:49,380 --> 00:06:53,040 All right enough said. So I'm going to store it in FirstWorkspace, 128 00:06:53,040 --> 00:06:54,540 and I'm going to select okay. 129 00:06:54,540 --> 00:06:58,200 Now you can see over here in my workspace view on the left 130 00:06:58,200 --> 00:07:00,700 that I've got my very FirstWorkspace. 131 00:07:00,700 --> 00:07:04,800 Now in and of itself, the workspace isn't really doing anything for me. 132 00:07:04,800 --> 00:07:06,800 It's just a holder for projects. 133 00:07:06,800 --> 00:07:10,300 So what I want to do now is I want to create my first project. 134 00:07:10,300 --> 00:07:15,690 So I can right click on the workspace and select new, new project. 135 00:07:17,690 --> 00:07:22,190 So I'm going to select that and now here we get a whole bunch of options. 136 00:07:22,690 --> 00:07:26,790 First, we need to name our project. So I'm just going to call it project1. 137 00:07:28,090 --> 00:07:32,090 Again, you can name it anything you like. Don't use spaces, don't use special characters, 138 00:07:32,090 --> 00:07:33,790 don't use international characters. 139 00:07:34,780 --> 00:07:37,380 Check this box right here, so it creates the project 140 00:07:37,380 --> 00:07:39,580 in its own folder that's important, 141 00:07:39,580 --> 00:07:42,840 that way we can create many projects within the workspace 142 00:07:42,840 --> 00:07:44,440 and they're all nice and separated. 143 00:07:45,100 --> 00:07:47,300 Now we've got a whole bunch of options here. 144 00:07:47,300 --> 00:07:51,700 It's important that you choose the right options. The first one is the category. 145 00:07:51,700 --> 00:07:56,060 So I'm going to select that. The category is going to be console. 146 00:07:56,060 --> 00:07:58,560 You can see that there's a whole bunch of other ones. 147 00:07:58,560 --> 00:08:02,000 Console is the one we're going to use, which is basically a non-graphical 148 00:08:02,000 --> 00:08:03,500 user interface, 149 00:08:03,500 --> 00:08:05,500 and it's going to go to your command prompt. 150 00:08:05,500 --> 00:08:07,000 That's where the output's going to go. 151 00:08:07,000 --> 00:08:10,300 So console, the type of project 152 00:08:10,300 --> 00:08:13,800 is simple, executable G++. 153 00:08:14,600 --> 00:08:16,300 Okay. Don't select any of these other ones. 154 00:08:16,300 --> 00:08:20,600 Those are all GUI-based and Macy make projects. We don't want any of those. 155 00:08:20,600 --> 00:08:24,590 We simply want simple executable G++. 156 00:08:24,590 --> 00:08:26,790 G++ is the compiler we're using. 157 00:08:28,020 --> 00:08:29,820 Now what's the compiler. 158 00:08:29,820 --> 00:08:33,320 Remember, we installed the compiler and then we just set it up in CodeLite. 159 00:08:33,320 --> 00:08:35,820 So when i select this, it should show it to me. 160 00:08:36,220 --> 00:08:38,520 And there it is mingw. 161 00:08:38,520 --> 00:08:42,120 We can install multiple compilers on our system. 162 00:08:42,120 --> 00:08:46,480 If you do that, you'll get a choice here of 2 or 3 or 4 or as many as you've installed. 163 00:08:46,680 --> 00:08:49,680 I only have the one installed, so I’m going to select it. 164 00:08:50,380 --> 00:08:51,680 The debugger, 165 00:08:52,080 --> 00:08:54,880 select GNU GDB debugger. 166 00:08:54,880 --> 00:08:56,880 This is the one that's used in windows. 167 00:08:57,580 --> 00:09:00,780 The LLDB debugger is the one that's used on mac, 168 00:09:00,780 --> 00:09:03,580 but this is a windows, video. So I'm going to install 169 00:09:03,580 --> 00:09:04,380 that guy. 170 00:09:04,380 --> 00:09:06,880 I'm going to select the GNU debugger rather. 171 00:09:07,380 --> 00:09:12,280 And then finally, this one here. This one here is the most important one of all. 172 00:09:12,280 --> 00:09:14,880 You've got to make sure this is set to default. 173 00:09:14,880 --> 00:09:18,180 If it's set to anything else, you're going to run into build issues. 174 00:09:18,180 --> 00:09:22,380 So set it to default. And you notice that it defaults to CodeLite make generator. 175 00:09:22,880 --> 00:09:25,380 Don't select it, select default. 176 00:09:25,980 --> 00:09:30,180 And now we're good to go. So let me go through this because this is really important. 177 00:09:30,180 --> 00:09:33,280 This is where most of the errors come up with the projects. 178 00:09:33,280 --> 00:09:35,280 We name our project using 179 00:09:35,280 --> 00:09:39,480 non-international characters and so forth, as I've mentioned already. 180 00:09:39,980 --> 00:09:44,880 Created in its own folder, the category is a console-based application. 181 00:09:45,280 --> 00:09:48,280 The type is simple executable G++. 182 00:09:49,080 --> 00:09:52,640 Compiler is mingw or whatever compiler you installed. 183 00:09:52,640 --> 00:09:55,840 The debugger for windows is GNU GDB. 184 00:09:55,840 --> 00:09:59,740 And later on in the course, we'll use a debugger and I'll show you how to use a debugger 185 00:09:59,740 --> 00:10:02,040 to find errors and walk through your code. 186 00:10:02,440 --> 00:10:05,540 And then the most important one your build system default. 187 00:10:05,540 --> 00:10:08,540 Okay. So you can pause the video here while you set yours up 188 00:10:08,540 --> 00:10:10,200 and make sure you get these just right. 189 00:10:10,850 --> 00:10:12,510 Okay. So now I'm going to select okay. 190 00:10:12,510 --> 00:10:16,110 And when I do select okay, you're going to see a project being created over here, 191 00:10:16,110 --> 00:10:19,470 called project1 in my workspace. So I'm going to select okay, 192 00:10:20,170 --> 00:10:23,470 and you can see that project1 has been selected. 193 00:10:23,670 --> 00:10:25,670 It has a source folder, 194 00:10:25,670 --> 00:10:27,970 and within it is main CPP. 195 00:10:27,970 --> 00:10:33,460 Now main CPP or main.cpp is our c++ program. 196 00:10:33,660 --> 00:10:37,760 Our source code, that's where we're going to type in our program 197 00:10:37,960 --> 00:10:40,260 that tells the computer what we want to do. 198 00:10:40,460 --> 00:10:42,820 Now I can't see that source code yet, 199 00:10:42,820 --> 00:10:47,020 but when I select it that source code will appear here in my editor. 200 00:10:47,020 --> 00:10:48,320 So I'm going to select it. 201 00:10:49,120 --> 00:10:52,480 I'm going to double click it, and you can see that it's right here. 202 00:10:52,980 --> 00:10:55,580 Now we're going to erase this in a minute and write our own, 203 00:10:55,580 --> 00:10:59,780 but you can see that there's my source code right here, now it's pretty small 204 00:10:59,780 --> 00:11:01,480 because I just installed CodeLite. 205 00:11:01,480 --> 00:11:04,480 So I'm going to make this font a little bit bigger 206 00:11:04,480 --> 00:11:06,480 so it shows up better on the video. 207 00:11:06,480 --> 00:11:09,580 So I'm going to select. You don't necessarily have to do this unless you want to 208 00:11:09,580 --> 00:11:11,580 but I'm going to select colors and fonts. 209 00:11:11,880 --> 00:11:15,280 And let's see I'm going to select it's 9. 210 00:11:15,280 --> 00:11:17,280 Now I want to select 16 211 00:11:17,780 --> 00:11:20,780 that should be a lot better so I'll apply okay 212 00:11:20,780 --> 00:11:23,380 and hopefully That'll be a lot easier to read. 213 00:11:23,380 --> 00:11:26,880 Okay. So as I said, I'm going to delete this code right now, 214 00:11:26,880 --> 00:11:30,080 and we're going to write. This is actually C code. 215 00:11:30,080 --> 00:11:32,080 We're going to write c++ code. 216 00:11:32,330 --> 00:11:34,930 You're probably going have a lot of questions. What does this mean? 217 00:11:34,930 --> 00:11:37,130 What does STD mean? What is all this stuff? 218 00:11:37,130 --> 00:11:41,330 Just follow along, type along. Let's get a clean build and run going. 219 00:11:41,330 --> 00:11:45,530 All of this is going to be explained in the course, as we go through it. 220 00:11:45,530 --> 00:11:48,730 So let's do this. Pound include 221 00:11:48,730 --> 00:11:51,730 and by pound, I'm using that hashtag symbol, 222 00:11:51,980 --> 00:11:53,180 then I've got 223 00:11:53,880 --> 00:11:56,880 iostream inside angle brackets. 224 00:11:57,680 --> 00:12:00,180 This allows us to do input and output. 225 00:12:01,080 --> 00:12:03,440 And then we're going to write our main function, 226 00:12:03,440 --> 00:12:06,840 every C++ program has to have a main function. 227 00:12:06,840 --> 00:12:09,040 So it looks kind of like this, int, 228 00:12:09,540 --> 00:12:10,840 the word main 229 00:12:10,840 --> 00:12:14,200 and then a left parenthesis followed by a right parenthesis. 230 00:12:14,600 --> 00:12:16,600 Then I've got a curly 231 00:12:17,400 --> 00:12:21,400 and a closed curly,an open curly, a left curly and a 232 00:12:21,400 --> 00:12:23,400 closed curly right here right curly. 233 00:12:23,400 --> 00:12:25,900 Notice that when I put that left curly in, 234 00:12:26,560 --> 00:12:29,560 I'll do that again and press enter 235 00:12:29,560 --> 00:12:32,060 the integrated development environment 236 00:12:32,060 --> 00:12:34,060 automatically closed it for me. 237 00:12:34,060 --> 00:12:36,860 That's my main function. Now within those curlies, 238 00:12:36,860 --> 00:12:40,860 I'm going to type STD followed by 2 colons, 239 00:12:40,860 --> 00:12:43,860 followed by C out. No spaces just 240 00:12:43,860 --> 00:12:46,460 STD::Cout. 241 00:12:46,660 --> 00:12:48,760 Then I've got two less than signs, 242 00:12:48,760 --> 00:12:51,360 side by side. No spaces between them. 243 00:12:51,360 --> 00:12:53,960 And then I'm just going to say hello testing. 244 00:12:56,620 --> 00:13:00,120 And all of that is inside that double quote character. 245 00:13:00,120 --> 00:13:03,420 It's not two single quotes, it's the double quote character. 246 00:13:03,820 --> 00:13:07,120 And then I'm going to say again less than, less than 247 00:13:07,120 --> 00:13:10,220 std::endl 248 00:13:10,220 --> 00:13:13,880 for endline and then the whole thing ends in a semicolon. 249 00:13:13,880 --> 00:13:15,380 It sounds like a lot. 250 00:13:15,380 --> 00:13:18,940 All we're doing is we're displaying hello testing to the console. 251 00:13:18,940 --> 00:13:22,140 That's all we're doing. Cout is the console, 252 00:13:22,140 --> 00:13:25,640 endline puts a new line at the end so that we go to the next line. 253 00:13:26,140 --> 00:13:29,640 Okay. Again, I'll explain all of this in the next couple of sections. 254 00:13:29,640 --> 00:13:32,940 So now what I'm going to do is I'm going to type return zero 255 00:13:34,240 --> 00:13:37,540 that tells the operating system that our program 256 00:13:37,540 --> 00:13:38,440 worked correctly. 257 00:13:39,540 --> 00:13:42,540 Perfect, now I need to save this. 258 00:13:42,540 --> 00:13:45,040 You'll notice this red bar right here, 259 00:13:45,040 --> 00:13:47,340 that's going from 1 through 6 right there. 260 00:13:47,840 --> 00:13:51,040 That's red that means that none of this has been saved. 261 00:13:51,040 --> 00:13:54,040 So I need to save this. I can come up to file, 262 00:13:54,400 --> 00:13:57,760 save a file or I can press ctrl S. 263 00:13:58,760 --> 00:14:00,260 I'm going to just click there. 264 00:14:00,460 --> 00:14:02,760 Notice that that bar is now green 265 00:14:03,010 --> 00:14:05,510 that means that you have saved your program. 266 00:14:06,610 --> 00:14:09,810 Okay. Now we're going to build and run this. 267 00:14:09,810 --> 00:14:13,110 So we're going to come up here to build and run. 268 00:14:13,110 --> 00:14:16,910 But before we do that, we need to set up a couple of things 269 00:14:16,910 --> 00:14:20,810 for our project. We want to use modern C++. 270 00:14:20,810 --> 00:14:24,710 We want to turn on warnings, and we want to do a couple of other things. 271 00:14:24,710 --> 00:14:28,310 So how do we do that? I can select my project right here, 272 00:14:28,810 --> 00:14:32,910 and I'm going to right click and I'm going to come down to settings. 273 00:14:34,010 --> 00:14:38,610 And then I've got all these options. Luckily we don't have to change too many of these. 274 00:14:38,610 --> 00:14:40,970 This is already set up that project 275 00:14:40,970 --> 00:14:43,970 wizard that we just did to create this where we chose 276 00:14:43,970 --> 00:14:47,170 console and simple executable and default all that. 277 00:14:47,170 --> 00:14:49,530 That's filled all of this out for us. 278 00:14:49,530 --> 00:14:52,630 What we need to do is we need to come to the compiler one right 279 00:14:52,630 --> 00:14:54,130 there that link right here, 280 00:14:54,930 --> 00:14:57,530 and we need to make a couple of little changes. 281 00:14:57,780 --> 00:14:59,980 We're going to come to the c++ compiler, 282 00:14:59,980 --> 00:15:02,980 not the c compiler with the c++ compiler. 283 00:15:02,980 --> 00:15:04,480 And I'm going to select 284 00:15:04,480 --> 00:15:09,080 that right here notice those three little dots that show up over here that little button. 285 00:15:09,380 --> 00:15:11,380 I'm going to select that button 286 00:15:11,980 --> 00:15:16,580 and I'm going to select enable c++ 17 features right here. 287 00:15:17,080 --> 00:15:20,080 In this video, the majority of the videos that I've done 288 00:15:20,080 --> 00:15:23,080 are using C++ 14 features. 289 00:15:23,080 --> 00:15:26,440 You canchoose 14 or you can choose 17. 290 00:15:26,440 --> 00:15:30,100 Do not choose both, that will really confuse 291 00:15:30,100 --> 00:15:31,200 the compiler. 292 00:15:31,700 --> 00:15:35,700 So I'm going to select c++ 17 features now. 293 00:15:36,200 --> 00:15:38,200 And notice what's down here 294 00:15:38,560 --> 00:15:41,560 w all which turns on all your warnings. 295 00:15:42,160 --> 00:15:46,460 And I've got a minus g and a minus optimization here the big O, 296 00:15:46,460 --> 00:15:48,820 that's it. That's all I really need to do. 297 00:15:48,820 --> 00:15:52,920 So you want to make sure that you've got you enable all the compiler warnings, 298 00:15:52,920 --> 00:15:55,220 enable c++ 17, 299 00:15:55,880 --> 00:15:57,980 optimize for debugging 300 00:15:57,980 --> 00:16:00,480 and produce debugging information. 301 00:16:00,480 --> 00:16:03,480 That's where all that's coming from. That's all we need to do. 302 00:16:03,480 --> 00:16:05,380 I'm going to select okay now, 303 00:16:06,480 --> 00:16:09,480 and one more thing come to the linker 304 00:16:11,080 --> 00:16:13,880 and then where it says linker options right here. 305 00:16:14,380 --> 00:16:16,880 You can just type -static 306 00:16:18,380 --> 00:16:19,880 and then we can apply. 307 00:16:19,880 --> 00:16:23,430 You don't have to do static but a lot of errors can come up 308 00:16:23,430 --> 00:16:28,330 without static and it's a lot easier just to learn c++ without those errors. 309 00:16:28,530 --> 00:16:30,230 And if anybody has any questions about that, 310 00:16:30,230 --> 00:16:34,330 you can ask me in the forums, and I'd be glad to get into more detail. 311 00:16:34,330 --> 00:16:37,630 That's it. I'm going to apply select okay. 312 00:16:38,230 --> 00:16:42,430 Now we're ready to run this. Again, make sure this is green here, 313 00:16:42,430 --> 00:16:45,230 it's good to go. So I'm going to come to build, 314 00:16:45,230 --> 00:16:46,830 and I'm going to select run. 315 00:16:48,430 --> 00:16:52,530 And here I've got the choice of executing it or building it and executing it. 316 00:16:53,330 --> 00:16:57,230 Again, I'll talk a lot more about the workflows in future videos, 317 00:16:57,230 --> 00:17:01,430 but we want to build it and then execute it. We want to compile it obviously. 318 00:17:01,430 --> 00:17:05,030 We have to compile this so that the computer can run it. So that's what I'm going to do. 319 00:17:05,230 --> 00:17:09,230 I'm going to select build and execute down here at the bottom. 320 00:17:09,829 --> 00:17:13,190 You'll see a bunch of stuff happened right. This is my output 321 00:17:14,490 --> 00:17:18,790 and this is my build. And you probably saw that little console window a second ago, 322 00:17:18,790 --> 00:17:22,990 and you can see it says hello testing. That's exactly what we want. 323 00:17:22,990 --> 00:17:27,349 Our program worked correctly. So this is being compiled and executed. 324 00:17:27,710 --> 00:17:31,610 We've got a command prompt window opening up, displaying the text. 325 00:17:31,610 --> 00:17:34,910 It says press any key to continue. I'm going to press enter 326 00:17:34,910 --> 00:17:36,310 and the window will close. 327 00:17:38,960 --> 00:17:39,960 Andit's gone. 328 00:17:40,620 --> 00:17:42,220 And down here is 329 00:17:42,220 --> 00:17:43,920 the output view. There's a 330 00:17:43,920 --> 00:17:47,920 whole bunch of stuff here we really are going to talk most just about one or two 331 00:17:47,920 --> 00:17:51,920 of them. The only two we care about are really build and output. 332 00:17:52,280 --> 00:17:56,380 And you can drag these around and put them wherever you want. But build tells you 333 00:17:56,380 --> 00:17:57,880 what's the build. 334 00:17:58,240 --> 00:18:00,940 Here you can see my compiler is being executed, 335 00:18:00,940 --> 00:18:04,600 and it's compiling stuff and it's doing all kinds of stuff. 336 00:18:04,600 --> 00:18:09,400 So if you run into compiler errors and issues, they're going to show up here. 337 00:18:09,950 --> 00:18:13,610 If in the forums, you'll post something about something not quite working, 338 00:18:13,610 --> 00:18:16,410 I might say show me your build output, 339 00:18:16,410 --> 00:18:19,710 this is what I want. I want you to grab this stuff right here 340 00:18:19,710 --> 00:18:24,310 and copy it in there or just give me a screenshot and post it that'd be really, really helpful. 341 00:18:24,810 --> 00:18:29,110 Now what can go wrong? Well, let's say you forgot the semicolon 342 00:18:29,710 --> 00:18:33,710 and notice that little red bar there, right. That little piece right there 343 00:18:33,710 --> 00:18:35,210 says that that's been changed. 344 00:18:35,210 --> 00:18:38,210 So I'm going to save. I'm pressing ctrl s here. 345 00:18:38,210 --> 00:18:42,010 Now it's green. I can go to build, run. 346 00:18:42,410 --> 00:18:46,610 Build and execute you can click on there if you like but don't do that yet we'll do that in a future 347 00:18:46,610 --> 00:18:50,410 video when I'll show you more about building build and execute 348 00:18:50,910 --> 00:18:53,510 see the red that's an error. 349 00:18:53,810 --> 00:18:57,110 It says error. I expected a semicolon. 350 00:18:57,510 --> 00:18:59,610 Like hey you forgot to do the semicolon. 351 00:18:59,610 --> 00:19:02,210 Notice this is red.Notice that 352 00:19:02,610 --> 00:19:04,110 if I click there, 353 00:19:04,360 --> 00:19:07,960 it takes me right to the error. There's a red arrow right here 354 00:19:07,960 --> 00:19:11,860 and it's telling me obviously I forgot the semicolon. So I'm going to save again. 355 00:19:12,220 --> 00:19:15,220 What else could go wrong? I forgot this quote mark. 356 00:19:15,720 --> 00:19:17,380 Again, I'm going to build and run. 357 00:19:19,880 --> 00:19:22,540 Well, an error right. Double click, 358 00:19:22,540 --> 00:19:24,340 I'm forgetting that. So 359 00:19:24,340 --> 00:19:28,140 these errors, I'll talk about different kinds of errors, common errors, 360 00:19:28,140 --> 00:19:29,640 again, in a few videos. 361 00:19:30,300 --> 00:19:33,000 The other thing that I've seen that's common is 362 00:19:33,000 --> 00:19:37,400 to put a 0 here instead of two parentheses. These are two parentheses 363 00:19:37,700 --> 00:19:38,500 not a 0. 364 00:19:38,500 --> 00:19:42,860 I know they look very, very similar sometimes when you do the 0 like that. 365 00:19:42,860 --> 00:19:45,860 But there's a left parenthesis followed by a right parenthesis. 366 00:19:46,160 --> 00:19:50,260 Okay. Main must be spelled correctly and iostream. 367 00:19:50,560 --> 00:19:53,760 Sometimes students will forget the r, 368 00:19:54,260 --> 00:19:57,860 and you'll see iosteam. Iosteam, the compiler will have no 369 00:19:57,860 --> 00:20:00,460 idea what that is. So if you build and run, 370 00:20:02,760 --> 00:20:06,750 that's it. No such file you're going to get all these errors like I have no idea what's going on. 371 00:20:06,750 --> 00:20:10,050 So you can fix that as well. It should be iostream. 372 00:20:10,450 --> 00:20:12,750 So that's it. This com 373 00:20:12,750 --> 00:20:17,150 this is configured now let me build and run one more time make sure we got rid of all those errors. 374 00:20:19,150 --> 00:20:23,610 That's it. We have a clean build down here. Notice 0 errors, 0 warnings. 375 00:20:24,270 --> 00:20:27,270 And I've got a clean run hello testing 376 00:20:27,270 --> 00:20:30,070 press any key to continue, and we're done. 377 00:20:30,670 --> 00:20:35,270 All right. So that's it. We're good to go. We're ready to start writing c++ 378 00:20:35,270 --> 00:20:38,270 programs. And I'll see you in the next video.