1 00:00:05,660 --> 00:00:09,660 Welcome back. Now that we've installed the c++ compiler 2 00:00:09,660 --> 00:00:13,540 and the CodeLite IDE, it's time to run CodeLite, 3 00:00:13,540 --> 00:00:17,940 get it set up and configured so that we can start writing c++ programs. 4 00:00:18,240 --> 00:00:22,240 So the first thing we're going to do is we're going to run CodeLite. Now remember, we just installed 5 00:00:22,240 --> 00:00:25,940 it in the previous video. If you haven't installed the compiler 6 00:00:25,940 --> 00:00:29,240 or CodeLite, please go back to the previous video and do that. 7 00:00:29,490 --> 00:00:33,140 So what I'm going to do, I'm just going to click on my applications down here, 8 00:00:33,140 --> 00:00:34,740 and I'm just going to type CodeLite, 9 00:00:35,540 --> 00:00:39,540 and you can see the icon here. If you right click on it, you can add it to your favorites over here 10 00:00:39,540 --> 00:00:42,240 on the left side. But I'm just going to double click it to run it. 11 00:00:45,010 --> 00:00:47,670 Okay now thefirst time that CodeLite runs, 12 00:00:47,670 --> 00:00:49,670 you may get this message down here 13 00:00:49,670 --> 00:00:53,970 at the bottom that says CodeLite now offers a better editor color support theme. 14 00:00:54,570 --> 00:00:58,570 If you don't, it's probably -- that's fine, it's probably a newer version of CodeLite. 15 00:00:58,570 --> 00:01:00,370 In this particular version, 16 00:01:00,370 --> 00:01:04,360 I'm going to click yes. But before I do that, we're going to run a setup wizard. 17 00:01:04,360 --> 00:01:06,460 And I just really want to get rid of all this clutter. 18 00:01:06,460 --> 00:01:10,160 Let's do this in a specific way. So I'm just going to cancel this wizard. 19 00:01:10,160 --> 00:01:13,360 I'm going to run the wizard in a moment, but I'm going to run it manually. 20 00:01:13,360 --> 00:01:16,060 And let CodeLite do its thing here. 21 00:01:16,060 --> 00:01:19,060 So I want to fix this now. I'm just going to select yes. 22 00:01:19,460 --> 00:01:23,450 It says now a CodeLite restart is needed. Would you like to restart now? 23 00:01:23,450 --> 00:01:24,050 Yes. 24 00:01:24,850 --> 00:01:28,650 CodeLite will now close for a second, and it'll open up automatically. 25 00:01:29,150 --> 00:01:33,450 And you can see that this is the CodeLite interface here. We've got this left side here. 26 00:01:33,450 --> 00:01:37,650 We've got all this white space here. Now it hasn't been configured yet. 27 00:01:37,900 --> 00:01:42,000 So we want to run that setup wizard that just popped up a second ago. 28 00:01:42,000 --> 00:01:45,000 I want to run that manually. So if you come up to help, 29 00:01:46,000 --> 00:01:49,600 you can see run the setup wizard right there. That's what I want to do. 30 00:01:49,800 --> 00:01:51,200 So I'm going to select that 31 00:01:52,390 --> 00:01:54,390 and, it says welcome to the setup wizard. 32 00:01:54,390 --> 00:01:58,990 Now we only have to do this one time. We don't have to do this every time we run CodeLite. 33 00:01:59,490 --> 00:02:01,790 So at this point, I'm just going to select next. 34 00:02:03,290 --> 00:02:05,950 It's going to ask me for my development profile. 35 00:02:05,950 --> 00:02:09,350 The CodeLite IDE supports CEC++ 36 00:02:09,350 --> 00:02:11,950 development PHP, JavaScript and so forth. 37 00:02:12,310 --> 00:02:15,810 I'm only going to use c++. So I'm just going to select 38 00:02:15,810 --> 00:02:18,810 c/c++development. 39 00:02:19,210 --> 00:02:20,610 Then I'm going to select next, 40 00:02:22,010 --> 00:02:24,510 and this part's really important. IT says 41 00:02:24,510 --> 00:02:26,210 let us set up your compiler for you. 42 00:02:26,210 --> 00:02:29,910 Remember, we've already installed the compiler but the compiler has to be able to work 43 00:02:29,910 --> 00:02:32,510 with CodeLite, and that's what this step does. 44 00:02:32,510 --> 00:02:36,170 So we're just going to let CodeLite scan our system for 45 00:02:36,170 --> 00:02:40,730 the compiler that we installed. So I'm just going to select this big button right here scan, 46 00:02:40,730 --> 00:02:41,830 and I'll select that. 47 00:02:42,630 --> 00:02:45,290 And you can see that CodeLite found the compiler and you 48 00:02:45,290 --> 00:02:47,190 can see there's several compilers here. 49 00:02:47,190 --> 00:02:50,290 It's really the same compiler. It's just using three different names. 50 00:02:50,690 --> 00:02:52,690 That's fine. Just select next. 51 00:02:54,050 --> 00:02:56,250 Now we can customize our colors. 52 00:02:56,750 --> 00:02:59,410 This is just the color for the CodeLite interface. 53 00:02:59,410 --> 00:03:03,510 I'm going to stay with system default because I think it looks better on video. 54 00:03:03,870 --> 00:03:06,470 The dark theme is really nice on the eyes. 55 00:03:06,470 --> 00:03:09,800 And if you like the dark theme, I'd suggest you do that one because it works great. 56 00:03:09,800 --> 00:03:13,100 But like i said for the videos, I'm just going to keep the default. 57 00:03:13,300 --> 00:03:14,800 I'm going to select next. 58 00:03:16,200 --> 00:03:20,560 I'm going to leave these settings as they are for the white space and indentation. 59 00:03:20,560 --> 00:03:22,160 And I'm going to select finish. 60 00:03:24,520 --> 00:03:27,320 CodeLite closes up and then it will reopen again. 61 00:03:27,320 --> 00:03:31,020 Now let's be absolutely sure our compilers are set up correctly. 62 00:03:31,020 --> 00:03:33,220 You can do that by going up to settings, 63 00:03:34,020 --> 00:03:36,380 and then selecting build settings. 64 00:03:38,080 --> 00:03:40,440 And you can see the compilers have been set up here. 65 00:03:40,440 --> 00:03:42,740 We're going to use GCC in our code. 66 00:03:42,740 --> 00:03:46,040 But you can see that we've got different versions of the compilers here. 67 00:03:46,540 --> 00:03:50,040 And as you can see the paths here have been set up for us, 68 00:03:50,040 --> 00:03:53,640 which is perfect that was the whole point of running the setup wizard. 69 00:03:54,140 --> 00:03:56,140 If these are empty over here, 70 00:03:56,140 --> 00:03:59,340 then you really need to run your setup wizard again 71 00:03:59,340 --> 00:04:03,440 or maybe even install the c++ compiler again because something's not right. 72 00:04:03,690 --> 00:04:06,790 Now what do we do? Well, we need to start writing our code. 73 00:04:06,790 --> 00:04:09,490 Well, in order to do that, we need a workspace. 74 00:04:09,490 --> 00:04:13,590 The way that CodeLite works is, it uses a workspace 75 00:04:13,590 --> 00:04:15,590 that contains projects. 76 00:04:15,590 --> 00:04:19,089 So each one of our projects is a c++ program, 77 00:04:19,089 --> 00:04:21,190 but they're housed in workspaces. 78 00:04:21,190 --> 00:04:24,690 but they're housed in workspaces. need to do is we need to create the workspace. 79 00:04:25,350 --> 00:04:28,850 We can do that right here by selecting new workspace 80 00:04:28,850 --> 00:04:32,400 or we can do it up here by selecting workspace,new workspace, 81 00:04:32,400 --> 00:04:36,200 again either place works fine. So I'm just going to click this button right here. 82 00:04:36,700 --> 00:04:40,950 New workspace, and I get this pop-up window that says what kind of workspace 83 00:04:40,950 --> 00:04:42,350 type you want to create? 84 00:04:42,350 --> 00:04:46,250 Well, I want to create a c++ workspace, that's what this class is all about. 85 00:04:46,250 --> 00:04:49,750 So I'm going to select c++ and select okay. 86 00:04:51,250 --> 00:04:54,450 And now where do I want to store. It basically where do I want to save 87 00:04:54,450 --> 00:04:58,550 these workspaces. So in this case, I'm just going to put it right in my documents folder. 88 00:04:59,050 --> 00:05:03,250 And my workspace name is I'm just going to call it first workspace. 89 00:05:03,250 --> 00:05:06,650 So I'm going to type FirstWorkspace. 90 00:05:07,850 --> 00:05:10,650 Now before I continue it's really important, 91 00:05:10,850 --> 00:05:14,750 I can't tell you how important this is. This is where most of the errors come up 92 00:05:14,750 --> 00:05:15,650 with building. 93 00:05:16,350 --> 00:05:19,350 Be sure that you don't use any spaces in here. 94 00:05:19,900 --> 00:05:23,700 Be sure you don't use any special characters in here. 95 00:05:23,700 --> 00:05:27,600 Keep it really, really simple. No international characters. 96 00:05:27,600 --> 00:05:30,260 Okay. So I'll say that one more time. No spaces. 97 00:05:30,260 --> 00:05:33,560 No special characters. No international characters. 98 00:05:33,560 --> 00:05:36,860 Those things cause all kinds of problems with building. 99 00:05:37,360 --> 00:05:39,760 So we want to keep the workspace names real simple, 100 00:05:39,760 --> 00:05:42,760 and that applies to project names and file names and 101 00:05:42,760 --> 00:05:45,760 everything else we do when we write c++ code. 102 00:05:46,060 --> 00:05:50,060 It's possible that your username you can see my username here on 103 00:05:50,060 --> 00:05:52,860 my ubuntu machine is Frank. 104 00:05:52,860 --> 00:05:55,460 It's possible that your username may have 105 00:05:55,460 --> 00:05:59,360 strange characters in it or international characters. If that's the case, 106 00:05:59,360 --> 00:06:01,720 find a different path to store this to 107 00:06:01,720 --> 00:06:04,820 make sure that all these characters are just really, really simple. 108 00:06:04,820 --> 00:06:08,220 So that's it. Workspace, I'm going to call it FirstWorkspace. 109 00:06:08,220 --> 00:06:10,220 You can see where it's going to be created. 110 00:06:10,220 --> 00:06:13,220 And it's going to create a file called FirstWorkspace 111 00:06:13,220 --> 00:06:15,420 .workspace that's the name of my file. 112 00:06:15,970 --> 00:06:19,270 Be sure you click down here, and make sure that's checked. 113 00:06:19,270 --> 00:06:21,670 Create the workspace under a separate directory that'll 114 00:06:21,670 --> 00:06:24,670 really handy because it'll keep everything nicely organized. 115 00:06:24,670 --> 00:06:26,170 That's it. Select okay, 116 00:06:26,830 --> 00:06:30,390 and you can see right over here on the left side where my mouse is that 117 00:06:30,390 --> 00:06:33,790 we've got our first workspace. Now in and of itself, 118 00:06:33,790 --> 00:06:36,390 a workspace isn't really do anything for you. 119 00:06:36,390 --> 00:06:40,050 The whole point of the workspace is to add projects to it. 120 00:06:40,050 --> 00:06:41,750 And that's what we're going to do now. 121 00:06:41,750 --> 00:06:44,450 So we're going to add a project to the workspace. 122 00:06:44,450 --> 00:06:49,050 We can do that by clicking on the workspace and then right clicking 123 00:06:49,550 --> 00:06:52,750 and selecting new, new project. 124 00:06:53,410 --> 00:06:57,410 Okay. So let me do that again right click on the first on your workspace, 125 00:06:57,410 --> 00:07:00,410 new, new project. I'll select that, 126 00:07:00,770 --> 00:07:02,870 and now we get this new project dialogue. 127 00:07:02,870 --> 00:07:05,270 And there's a whole bunch of settings here, 128 00:07:05,270 --> 00:07:07,870 and these are really really important to get right. 129 00:07:07,870 --> 00:07:12,270 First of all, we're in the workspace we created. That's exactly what we wanted. 130 00:07:12,770 --> 00:07:14,670 So now what's the name of the project? 131 00:07:14,670 --> 00:07:18,330 Well, we can have multiple projects in the workspace, as I said. 132 00:07:18,330 --> 00:07:20,830 So I'm just going to call this project1. 133 00:07:21,190 --> 00:07:24,860 Again, no spaces. No special characters. No international characters. 134 00:07:25,360 --> 00:07:29,960 Make sure that this check is checked. Create the project in its own folder 135 00:07:29,960 --> 00:07:31,560 that will allow us to have 136 00:07:31,560 --> 00:07:35,460 one folder for each project we create that keeps it nicely organized. 137 00:07:35,960 --> 00:07:40,360 Now these settings here are really important to get right.So I'll go through them really slowly. 138 00:07:40,360 --> 00:07:41,860 The first one is category. 139 00:07:42,460 --> 00:07:46,460 The category is going to be console. You can see we can create graphical 140 00:07:46,460 --> 00:07:49,460 user interfaces, templates, all kinds of stuff. 141 00:07:49,460 --> 00:07:52,160 We want to create a console application. 142 00:07:52,160 --> 00:07:55,160 That's an application that runs in the terminal window. 143 00:07:55,960 --> 00:08:00,860 The type is going to be simple executable g++. 144 00:08:01,060 --> 00:08:05,050 Okay. Again, really important simple executable g ++. 145 00:08:05,050 --> 00:08:08,550 G++ is the name of our c++ compiler. 146 00:08:08,550 --> 00:08:12,050 It's got the g because it was created by the gnu foundation. 147 00:08:12,410 --> 00:08:15,010 So, again simple executable g ++. 148 00:08:15,010 --> 00:08:18,310 Don't choose any of these other ones or you're going to get all kinds of build problems. 149 00:08:19,300 --> 00:08:22,800 The compiler. Remember, we ran that setup wizard. 150 00:08:22,800 --> 00:08:26,300 So now we're going to come to compiler. I'm just going to choose GCC. 151 00:08:27,400 --> 00:08:31,400 The debugger, we want to choose the gnu GDB debugger. 152 00:08:33,100 --> 00:08:36,100 And then this last one is the most important of all which build 153 00:08:36,100 --> 00:08:40,500 system do we want to use. Make sure that you choose default. 154 00:08:42,000 --> 00:08:46,250 Okay. So I'm going to leave this here for a second. You guys can pause the video and double check. 155 00:08:46,250 --> 00:08:49,750 But I'll go through it one more time. Category is console. 156 00:08:49,750 --> 00:08:52,950 And before that, make sure that you've checked this little checkbox here. 157 00:08:53,450 --> 00:08:55,450 So we've got category is console. 158 00:08:55,450 --> 00:08:58,150 The type is simple executable g++. 159 00:08:58,950 --> 00:09:01,210 The compiler is your GCC compiler. 160 00:09:01,810 --> 00:09:04,810 The debugger is the gnu GDB debugger. 161 00:09:04,810 --> 00:09:08,810 And the build system, very important that it's default. Okay. 162 00:09:08,810 --> 00:09:11,010 Once we do that, we select okay 163 00:09:11,010 --> 00:09:14,710 and what you'll see is you'll see over here in the workspace view on the top left. 164 00:09:14,710 --> 00:09:19,110 You'll see a project, project1 being created under it. So I'm going to click okay. 165 00:09:20,470 --> 00:09:23,240 And you can see that our first project is here. 166 00:09:23,240 --> 00:09:26,340 See all this white space over here on the right. That's where we're going to be 167 00:09:26,340 --> 00:09:30,000 typing our code. So you can expand these 168 00:09:30,000 --> 00:09:31,600 little chevrons here. 169 00:09:31,600 --> 00:09:35,000 And you can see that our project1 has a source folder in it, 170 00:09:35,000 --> 00:09:37,000 that's where our source code is going to be. 171 00:09:37,660 --> 00:09:41,460 And in there, there's a file called main.cpp. 172 00:09:41,710 --> 00:09:44,710 That's our first c++ program. 173 00:09:45,210 --> 00:09:48,870 So I want to see that. I want to edit that. So what I want to do is double click it. 174 00:09:48,870 --> 00:09:53,130 And when I double click, it it'll show up over here in this white space. So I'm going to double click it. 175 00:09:54,120 --> 00:09:56,320 And you can see the source code right here. 176 00:09:56,820 --> 00:09:59,420 And this is what we want to set up. 177 00:09:59,420 --> 00:10:03,520 Now what I'm going to do is I just installed CodeLite fresh on this system. 178 00:10:03,520 --> 00:10:07,420 This font is a little bit too small for video. It's probably fine on your end. 179 00:10:07,420 --> 00:10:09,020 But for video, it's a bit small. 180 00:10:09,020 --> 00:10:11,620 So I'm just going to go to settings. You don't have to do this. 181 00:10:11,620 --> 00:10:14,620 But I'm going to set my colors and fonts. 182 00:10:14,620 --> 00:10:18,520 And let's see. I just want to set my font to 183 00:10:19,020 --> 00:10:20,010 16, 184 00:10:21,940 --> 00:10:23,940 something like that. I'll select that, 185 00:10:24,340 --> 00:10:26,670 and I'll select apply and okay. And 186 00:10:26,670 --> 00:10:30,170 that should be a little bit more readable for you guys on the video side. 187 00:10:31,530 --> 00:10:33,830 All right. So we're almost there. 188 00:10:33,830 --> 00:10:37,930 What we're going to do is, this is actually c code and not c++ code. 189 00:10:37,930 --> 00:10:40,530 So what I'm going to do is I'm going to delete this code right here, 190 00:10:40,530 --> 00:10:44,130 and we're going to write our very first c++ program. 191 00:10:44,630 --> 00:10:48,290 And we're going to do that right now. So I'm going to select all this code here, 192 00:10:48,290 --> 00:10:51,890 and I'm just going to press backspace or delete just to delete it. 193 00:10:52,690 --> 00:10:55,190 Now I'm going to type a few lines of code. 194 00:10:55,190 --> 00:10:56,690 Please just type along, 195 00:10:56,690 --> 00:11:01,090 follow along. I know you're going to have a lot of questions. You know what does this mean, what does that mean. 196 00:11:01,590 --> 00:11:04,390 Hang in there, stay tuned as they say. 197 00:11:04,390 --> 00:11:08,290 It'll all be explained in the course. But first we need to be sure that we've got 198 00:11:08,290 --> 00:11:11,290 our project set up correctly and that we can run. 199 00:11:11,290 --> 00:11:15,490 Okay. So let's start. We're going to type pound include 200 00:11:16,150 --> 00:11:18,750 and then iostream 201 00:11:18,750 --> 00:11:21,250 in angle brackets and I'm going to press enter. 202 00:11:21,910 --> 00:11:24,810 Pound include again the pound is the hashtag symbol 203 00:11:24,810 --> 00:11:29,410 pound include space and iostream in angle brackets. 204 00:11:29,410 --> 00:11:31,770 That's a less than and a greater than sign on each end. 205 00:11:32,670 --> 00:11:34,170 Then I'm going to type int 206 00:11:35,370 --> 00:11:36,370 main 207 00:11:36,970 --> 00:11:39,970 followed by left parenthesis and a right parenthesis. 208 00:11:40,770 --> 00:11:43,370 Then I'm going to type in a left curly bracket. 209 00:11:44,370 --> 00:11:47,870 And notice when I typed in that left curly bracket, I'll do that again. 210 00:11:48,570 --> 00:11:51,170 I'll type in the left curly note and press enter. 211 00:11:51,170 --> 00:11:54,170 Notice that the IDE closed it with the right curly. 212 00:11:54,830 --> 00:11:58,230 Okay. The IDE will do that automatically for you. 213 00:11:59,130 --> 00:12:02,630 It'll match it up. So right in here, I'm going to type std 214 00:12:03,030 --> 00:12:06,730 Followed by two columns ::, followed by cout 215 00:12:08,230 --> 00:12:12,890 a space, two less than signs, again, no space between them << 216 00:12:12,890 --> 00:12:16,190 and then I'm going to type hello testing inside double quotes, 217 00:12:19,390 --> 00:12:20,380 just like that. 218 00:12:22,680 --> 00:12:26,280 Again, < 00:12:28,580 ::endl; 220 00:12:29,570 --> 00:12:32,070 and then right here, I'm going to type return zero. 221 00:12:32,670 --> 00:12:36,440 So let me go through this one more time be sure you get it just right. Int main 222 00:12:36,440 --> 00:12:39,440 left paren, right paren, open curly, 223 00:12:39,800 --> 00:12:43,800 std::cout altogether no spaces. 224 00:12:43,800 --> 00:12:48,000 Then we've got a space << hello testing in 225 00:12:48,000 --> 00:12:49,000 double quotes. 226 00:12:49,800 --> 00:12:54,500 Again, << and then std::endl. 227 00:12:54,500 --> 00:12:58,400 All we're doing is we're including the iostream library 228 00:12:58,400 --> 00:13:02,300 which allows us to do input output. We're going to do output in this case. 229 00:13:02,850 --> 00:13:05,750 And in this case, all I want to do is I want to display 230 00:13:05,750 --> 00:13:10,250 hello testing you can see it right here. I want to display hello testing to the screen. 231 00:13:10,350 --> 00:13:15,580 And this is how we do it. We output it to the cout, which is our our console. 232 00:13:15,780 --> 00:13:18,780 And then we're going to put a new line on the end. That's it. 233 00:13:18,780 --> 00:13:21,280 We're returning zero because we always return zero 234 00:13:21,280 --> 00:13:23,580 from main. I'll talk more about that later on. 235 00:13:24,080 --> 00:13:25,080 And that's it. 236 00:13:25,080 --> 00:13:28,440 Now you'll notice over here, I've got this reddish orange bar 237 00:13:28,440 --> 00:13:29,940 that's going from 1 to 6. 238 00:13:30,540 --> 00:13:34,540 That means it's actually red on my system. It might show up orange 239 00:13:34,540 --> 00:13:38,200 some on video. Sometimes it does. That just means I haven't saved this yet. 240 00:13:38,900 --> 00:13:43,300 It's really important that I save my file. So I can come up to file, 241 00:13:44,290 --> 00:13:47,290 save file here or press ctrl s, 242 00:13:47,540 --> 00:13:48,540 either way. 243 00:13:48,540 --> 00:13:50,540 I'm just going to press ctrl s, and you'll 244 00:13:50,540 --> 00:13:53,340 see the color change. I'm going to press ctrl s, 245 00:13:53,340 --> 00:13:55,600 and notice that now it became green 246 00:13:55,600 --> 00:13:59,900 that means it's saved. That's really important. Be sure that you save your file 247 00:13:59,900 --> 00:14:04,000 before you try to build it. Otherwise you may not get what you expect. 248 00:14:04,500 --> 00:14:08,100 So that's my program. It's a really simple c++ program. 249 00:14:08,100 --> 00:14:11,100 It's got some stuff in there that I know you've got questions about. 250 00:14:11,100 --> 00:14:13,400 . As I said, stay tuned, it's all coming. 251 00:14:13,900 --> 00:14:16,900 Now what we need to do is we need to build this and run it. 252 00:14:16,900 --> 00:14:20,800 But before we do that, we need to set a few settings for our project. 253 00:14:21,050 --> 00:14:24,850 So let's do that. Click on your project1 right here. 254 00:14:25,850 --> 00:14:29,750 Right click on it, and then all the way down at the bottom, we're going to see settings. 255 00:14:29,750 --> 00:14:31,150 So select settings. 256 00:14:32,350 --> 00:14:35,050 Now you'll notice that the general is set up right here. 257 00:14:35,050 --> 00:14:36,750 Right, that that's been selected. 258 00:14:36,750 --> 00:14:40,750 And all this stuff on the right is stuff that was already set up for us from that 259 00:14:40,750 --> 00:14:41,650 project wizard, 260 00:14:41,650 --> 00:14:44,850 the new project wizard. We don't have to mess with any of that. 261 00:14:44,850 --> 00:14:48,750 What we do have to change is we're going to go to where it says compiler right here. 262 00:14:49,850 --> 00:14:54,050 And then I'm going to come up to where it says c++ compiler options. 263 00:14:54,050 --> 00:14:58,650 And right here, you'll see a -g, a -o and a -wall and all this other stuff. 264 00:14:58,650 --> 00:14:59,850 I'm just going to click on there. 265 00:15:00,950 --> 00:15:04,050 And you'll see a button that pops up right over here on the right 266 00:15:04,050 --> 00:15:06,550 with three dots. I want to select that button. 267 00:15:08,350 --> 00:15:12,150 And now we've got all kinds of options that we can set for the compiler here. 268 00:15:12,810 --> 00:15:16,810 We're just going to set a few options. Actually, we're going to leave the same options that are there. 269 00:15:16,810 --> 00:15:20,010 But we want to add one more. We want to click right on here where it says 270 00:15:20,010 --> 00:15:23,310 enable c++17 features. 271 00:15:23,310 --> 00:15:27,310 Now in this course, I've used mostly c++14. 272 00:15:27,310 --> 00:15:29,310 And that's what you're going to see in a lot of the videos. 273 00:15:29,310 --> 00:15:32,210 But this version supports c++17, 274 00:15:32,210 --> 00:15:34,110 and they're very very very similar. 275 00:15:34,610 --> 00:15:38,270 The only differences between them are going to be explained in the course, 276 00:15:38,270 --> 00:15:42,260 and most of them are more advanced and they're not they're not going to affect learning 277 00:15:42,260 --> 00:15:44,920 basic foundational modern c++. 278 00:15:44,920 --> 00:15:46,800 These are the settings we need to have on. 279 00:15:46,800 --> 00:15:48,800 Enable all compiler warnings, 280 00:15:49,100 --> 00:15:51,300 enable c++17 features. 281 00:15:52,100 --> 00:15:53,900 I'll scroll down a little bit here, 282 00:15:55,200 --> 00:15:57,100 optimize for debugging 283 00:15:57,100 --> 00:15:59,100 and produce debugging information. 284 00:15:59,100 --> 00:16:02,700 So those four settings are what you see right down here in the command line. 285 00:16:03,100 --> 00:16:06,500 So I'm just going to click okay, apply 286 00:16:07,300 --> 00:16:08,800 and click okay again. 287 00:16:08,800 --> 00:16:13,300 Now finally we're good to go. Let's run this. We can come up to build, 288 00:16:14,400 --> 00:16:16,900 and we can type build and run project 289 00:16:16,900 --> 00:16:20,200 right here. That's what I'm going to do. I'm going to select build and run project. 290 00:16:21,000 --> 00:16:24,800 And you could see down here a bunch of stuff just happened really quickly. 291 00:16:24,800 --> 00:16:29,300 First of all, the good thing that happened is we popped up this terminal that says hello testing. 292 00:16:29,300 --> 00:16:32,600 Hey that's what we wanted, right. That's what our program was supposed to do. 293 00:16:32,600 --> 00:16:36,700 And then it says hit any key to continue. So I'm just going to press enter. 294 00:16:36,700 --> 00:16:40,060 There notice the window popped away, which is what also what I want. 295 00:16:40,060 --> 00:16:43,060 There's two tabs down here that are very important. 296 00:16:43,060 --> 00:16:47,320 One is the output tab. This is just -- this is not the output of your program. 297 00:16:47,320 --> 00:16:49,820 This is the output of trying to run your program. 298 00:16:49,820 --> 00:16:52,420 So this is what opens up that terminal we just saw. 299 00:16:52,420 --> 00:16:55,420 The other one that's really important is this build tab right here. 300 00:16:55,420 --> 00:16:58,620 Those are the only two that we generally will use in this class. 301 00:16:58,620 --> 00:16:59,920 So I'm going to select build. 302 00:17:00,820 --> 00:17:05,220 And you can see right here that your compiler is being executed. 303 00:17:05,220 --> 00:17:09,319 You can see those switches, those compiler options right over here that we just set up. 304 00:17:09,680 --> 00:17:13,079 And the good thing here it says zero error, zero warnings. 305 00:17:13,740 --> 00:17:15,740 What could go wrong? Well, 306 00:17:15,740 --> 00:17:18,140 you maybe you forgot this semicolon here. 307 00:17:18,800 --> 00:17:23,790 And then notice again that I've got that little orange red right here, right. I need to save that. 308 00:17:24,089 --> 00:17:26,390 So I'm going to ctrl s and save. 309 00:17:26,390 --> 00:17:28,640 And then again, I'm going to go to build, build and run. 310 00:17:29,140 --> 00:17:33,500 And notice that I've got errors. Do I want to continue? No, I don't want to continue. 311 00:17:33,900 --> 00:17:36,900 But notice my build output. You see the error right here. 312 00:17:37,300 --> 00:17:39,800 It's red. If I select that and click on it, 313 00:17:39,800 --> 00:17:41,800 it takes me up to the code 314 00:17:41,800 --> 00:17:45,600 and what happened was here's the error. It's expecting a semicolon. 315 00:17:45,960 --> 00:17:47,960 So I forgot the semicolon. 316 00:17:47,960 --> 00:17:52,110 Now if you type this program, again, I'll save it as is -- if you type this program exactly 317 00:17:52,110 --> 00:17:54,710 like I typed it, you shouldn't get any errors. 318 00:17:54,710 --> 00:17:58,610 If you do and you post in the forum, I might say something like, 319 00:17:58,610 --> 00:18:01,910 can you show me your build output? This is what i want to see, 320 00:18:01,910 --> 00:18:05,570 just copy and paste this stuff or give me a screenshot that way I can 321 00:18:05,970 --> 00:18:07,570 exactly see what's going on. 322 00:18:07,570 --> 00:18:11,070 Now typical errors are that forgetting a semicolon, 323 00:18:11,070 --> 00:18:14,670 forgetting to put a quote mark here. We've got a quote mark here, 324 00:18:14,670 --> 00:18:17,970 and we've got another one here. Sometimes students will -- 325 00:18:18,470 --> 00:18:22,870 these two parentheses sometimes when they're together, it looks like a 0, 326 00:18:23,120 --> 00:18:25,920 like that they'll put a 0 in here and that'll be a mistake. 327 00:18:25,920 --> 00:18:28,520 So this is a left paren followed by a right paren. 328 00:18:29,070 --> 00:18:32,870 And another common mistake is to to iosteam here. 329 00:18:32,870 --> 00:18:34,870 I don't know why, but a lot of people do that. 330 00:18:34,870 --> 00:18:38,470 So it's iosteam that's incorrect, it should be iostream. 331 00:18:39,130 --> 00:18:42,130 So any one of those will cause an error down here. 332 00:18:42,630 --> 00:18:45,400 All right. So that's really pretty much it for this video. 333 00:18:45,400 --> 00:18:48,500 We're all set up to run c++ programs. 334 00:18:48,500 --> 00:18:52,500 If you have any errors, post them on the forums along with the build output. 335 00:18:52,900 --> 00:18:54,900 And I'll get back to you with the fix. 336 00:18:55,300 --> 00:18:57,400 Okay. So let's learn c++.