1 00:00:00,211 --> 00:00:01,123 (bright music) 2 00:00:01,123 --> 00:00:02,760 (zooming) 3 00:00:02,760 --> 00:00:05,400 (keyboard typing) 4 00:00:05,400 --> 00:00:07,620 Mitropoulos: Now that CodeLite is installed, 5 00:00:07,620 --> 00:00:09,570 we need to run it, configure it, 6 00:00:09,570 --> 00:00:10,890 and then run a little test program 7 00:00:10,890 --> 00:00:13,170 to make sure our configuration is correct. 8 00:00:13,170 --> 00:00:14,400 So the first thing we wanna do is, 9 00:00:14,400 --> 00:00:15,541 we wanna find CodeLite 10 00:00:15,541 --> 00:00:17,820 and you can just type "Code" in the search 11 00:00:17,820 --> 00:00:20,133 and you'll find CodeLite, and double click. 12 00:00:22,140 --> 00:00:23,280 Now the first time it runs, 13 00:00:23,280 --> 00:00:25,170 you may get a small window like this 14 00:00:25,170 --> 00:00:26,190 and it's probably a good idea 15 00:00:26,190 --> 00:00:27,790 just to make it a little larger. 16 00:00:28,890 --> 00:00:31,800 Okay, now, sometimes when you run it the first time, 17 00:00:31,800 --> 00:00:34,680 you'll get a setup wizard that runs, sometimes you don't. 18 00:00:34,680 --> 00:00:38,070 We'd like to run the setup wizard, so if it doesn't show up, 19 00:00:38,070 --> 00:00:42,123 you can go to help, run the setup wizard, and select that. 20 00:00:43,440 --> 00:00:45,240 And you get a window that pops up. 21 00:00:45,240 --> 00:00:46,623 So I'll select next. 22 00:00:47,790 --> 00:00:51,900 Now here, CodeLite supports PHP and Node 23 00:00:51,900 --> 00:00:53,340 and a few other technologies. 24 00:00:53,340 --> 00:00:55,560 We really don't want all that clutter on our IDE. 25 00:00:55,560 --> 00:00:58,260 We wanna strictly concentrate on C plus plus. 26 00:00:58,260 --> 00:01:01,680 So I would suggest that we clear all the plugins 27 00:01:01,680 --> 00:01:04,500 and then turn on only the C plus plus plugins. 28 00:01:04,500 --> 00:01:06,780 So you can see now that not everything is checked, 29 00:01:06,780 --> 00:01:08,917 only the C plus plus plugins are checked 30 00:01:08,917 --> 00:01:10,863 and we'll select next. 31 00:01:11,940 --> 00:01:15,480 Now we'll scan our computer for any installed compilers. 32 00:01:15,480 --> 00:01:19,530 So we'll scan the computer and it's found GCC across GCC. 33 00:01:19,530 --> 00:01:21,120 I'm gonna select GCC. 34 00:01:21,120 --> 00:01:24,120 GCC stands for the GNU Compiler Collection, 35 00:01:24,120 --> 00:01:28,620 which includes CEC plus plus, Fortran 8 and a few others. 36 00:01:28,620 --> 00:01:29,853 I'll select next. 37 00:01:31,344 --> 00:01:33,390 As far as the editor theme, 38 00:01:33,390 --> 00:01:35,850 and this is really a preference for you, 39 00:01:35,850 --> 00:01:38,730 this dark monichi theme is really easy on the eyes 40 00:01:38,730 --> 00:01:40,650 but it doesn't show up too well on video. 41 00:01:40,650 --> 00:01:41,483 So I'm going to select 42 00:01:41,483 --> 00:01:45,480 the classic eclipse look for the videos. 43 00:01:45,480 --> 00:01:46,857 You can choose whatever your preference is. 44 00:01:46,857 --> 00:01:48,821 And I'll press next. 45 00:01:48,821 --> 00:01:53,373 I'll leave these defaults as is and press finish. 46 00:01:56,730 --> 00:01:59,100 Okay. Now, sometimes it opens up two windows 47 00:01:59,100 --> 00:01:59,933 like you see here. 48 00:01:59,933 --> 00:02:01,270 So I wanna save and exit 49 00:02:02,970 --> 00:02:06,720 and I wanna shut down all the versions that I've got going. 50 00:02:06,720 --> 00:02:09,240 I don't know why it does this, but it does it a few times. 51 00:02:09,240 --> 00:02:10,690 And I'll save and exit again. 52 00:02:11,580 --> 00:02:13,440 Alright, so now let's, now we're back to normal. 53 00:02:13,440 --> 00:02:14,430 Let's try that again. 54 00:02:14,430 --> 00:02:15,640 So we'll run CodeLite 55 00:02:19,080 --> 00:02:23,850 and let's make this full screen again. Perfect. 56 00:02:23,850 --> 00:02:25,290 Okay, so now what we need to do is 57 00:02:25,290 --> 00:02:26,970 we need to create a workspace. 58 00:02:26,970 --> 00:02:28,680 A workspace is an area 59 00:02:28,680 --> 00:02:31,380 where we can have our C plus plus projects. 60 00:02:31,380 --> 00:02:34,830 So we can have many C plus plus projects in one workspace. 61 00:02:34,830 --> 00:02:37,470 We can do that by selecting this button here 62 00:02:37,470 --> 00:02:38,910 called new workspace, 63 00:02:38,910 --> 00:02:42,810 or we can go up to file, new, 64 00:02:42,810 --> 00:02:44,460 new workspace either place. 65 00:02:44,460 --> 00:02:46,950 So I'm gonna select this button here. 66 00:02:46,950 --> 00:02:48,810 And it's gonna ask you for the workspace name. 67 00:02:48,810 --> 00:02:49,923 This could be any name you like. 68 00:02:49,923 --> 00:02:53,710 I'm going to say CPP workspace 69 00:02:55,410 --> 00:02:57,840 and I'm going to put this on my desktop. 70 00:02:57,840 --> 00:02:59,040 You can store it anywhere you like 71 00:02:59,040 --> 00:03:00,720 as long as you remember where it's at. 72 00:03:00,720 --> 00:03:02,520 So I'm gonna put this on my desktop. 73 00:03:07,080 --> 00:03:09,780 I want to create the workspace under a separate directory 74 00:03:09,780 --> 00:03:12,000 that'll help me organize my files better, 75 00:03:12,000 --> 00:03:13,023 and press okay. 76 00:03:14,250 --> 00:03:15,083 That's it. 77 00:03:15,083 --> 00:03:15,960 Now we've got a workspace 78 00:03:15,960 --> 00:03:18,300 which you can see here on the left side. 79 00:03:18,300 --> 00:03:23,300 I can right click on that now and create a new project. 80 00:03:23,430 --> 00:03:26,673 Again, I can also go up file, new project. 81 00:03:27,810 --> 00:03:28,833 So I'll do that. 82 00:03:29,760 --> 00:03:32,700 Now we've got some options here as to which template to use 83 00:03:32,700 --> 00:03:33,840 to create the project. 84 00:03:33,840 --> 00:03:36,720 We're gonna stick to the console template, 85 00:03:36,720 --> 00:03:39,390 which is just basically a terminal window. 86 00:03:39,390 --> 00:03:41,010 And we want G plus plus. 87 00:03:41,010 --> 00:03:43,110 That's the C plus plus compiler. 88 00:03:43,110 --> 00:03:44,340 It's called G plus plus 89 00:03:44,340 --> 00:03:47,070 because it's the GNU C plus plus compiler. 90 00:03:47,070 --> 00:03:48,303 I'll select next. 91 00:03:50,010 --> 00:03:51,600 What's my project name? 92 00:03:51,600 --> 00:03:53,243 It could be anything you like. 93 00:03:53,243 --> 00:03:55,950 Don't use spaces for any of these project names. 94 00:03:55,950 --> 00:03:57,250 So I'll just say test one. 95 00:03:59,700 --> 00:04:02,580 And again, I wanna create a project in a separate directory 96 00:04:02,580 --> 00:04:03,690 under the workspace. 97 00:04:03,690 --> 00:04:04,953 So I'll select next. 98 00:04:06,150 --> 00:04:08,400 Now it's gonna ask you which compiler do you want to use. 99 00:04:08,400 --> 00:04:10,376 You may have a lot of different compilers on your system. 100 00:04:10,376 --> 00:04:13,595 Just select the one that you used in the setup wizard 101 00:04:13,595 --> 00:04:15,240 and you'll be fine. 102 00:04:15,240 --> 00:04:17,130 And these defaults are perfectly fine. 103 00:04:17,130 --> 00:04:18,333 We'll select finish. 104 00:04:19,170 --> 00:04:23,880 And that creates a test project under the CPP workspace. 105 00:04:23,880 --> 00:04:24,900 And you can see it's called, 106 00:04:24,900 --> 00:04:26,640 it's created a source directory. 107 00:04:26,640 --> 00:04:29,340 And in there it's got a main CPP file. 108 00:04:29,340 --> 00:04:31,350 That's our C plus plus source code. 109 00:04:31,350 --> 00:04:33,690 And we'll get to that in a second. 110 00:04:33,690 --> 00:04:36,060 We need to do a couple of bits of configuration though 111 00:04:36,060 --> 00:04:37,653 before we we do anything else. 112 00:04:38,730 --> 00:04:41,820 Let's go to our project, test one in this case. 113 00:04:41,820 --> 00:04:43,470 And we'll right click 114 00:04:43,470 --> 00:04:45,750 and we'll go down to the bottom where it says settings 115 00:04:45,750 --> 00:04:47,610 and we'll select that. 116 00:04:47,610 --> 00:04:50,640 And then we'll go to where it says compiler options. 117 00:04:50,640 --> 00:04:52,440 And notice I'm in the global settings, 118 00:04:52,440 --> 00:04:53,273 that's pretty important. 119 00:04:53,273 --> 00:04:55,890 I'm in the global settings, compiler options. 120 00:04:55,890 --> 00:04:57,870 And then I'll select these three little dots here 121 00:04:57,870 --> 00:04:59,250 on the button. 122 00:04:59,250 --> 00:05:02,280 And I wanna make sure that W all is selected, 123 00:05:02,280 --> 00:05:04,410 that way we always get warnings 124 00:05:04,410 --> 00:05:06,660 and I wanna make sure that the C plus plus, 125 00:05:06,660 --> 00:05:09,690 standard C plus plus 14 is selected. 126 00:05:09,690 --> 00:05:12,000 That's the latest standard for C plus plus. 127 00:05:12,000 --> 00:05:12,934 That'll make sure that we're using 128 00:05:12,934 --> 00:05:15,900 the modern C plus plus compiler. 129 00:05:15,900 --> 00:05:19,530 At that point you can click okay, apply. 130 00:05:19,530 --> 00:05:22,050 Okay, good. 131 00:05:22,050 --> 00:05:26,280 Now we can go to our workspace and right click on that, 132 00:05:26,280 --> 00:05:28,203 and come down to workspace settings. 133 00:05:29,490 --> 00:05:32,100 And you'll see environment and code completion. 134 00:05:32,100 --> 00:05:33,390 Go to the code completion 135 00:05:33,390 --> 00:05:36,321 and select enable C plus plus 14 standard. 136 00:05:36,321 --> 00:05:38,400 The code completion is a tool 137 00:05:38,400 --> 00:05:40,781 that the integrated development environment uses 138 00:05:40,781 --> 00:05:43,890 that tries to figure out what I'm typing 139 00:05:43,890 --> 00:05:45,420 and what I want to type. 140 00:05:45,420 --> 00:05:47,760 And it helps predict what I want to do so it can help me 141 00:05:47,760 --> 00:05:48,733 so I don't have to type so much 142 00:05:48,733 --> 00:05:51,085 and it can do some checking as it goes. 143 00:05:51,085 --> 00:05:52,680 In this case, I'm just telling it 144 00:05:52,680 --> 00:05:55,470 to use the modern C plus plus compiler. 145 00:05:55,470 --> 00:05:56,643 I'll select okay. 146 00:05:58,050 --> 00:05:58,883 And that's it. 147 00:05:58,883 --> 00:06:01,020 Now we can run a simple test program. 148 00:06:01,020 --> 00:06:04,140 We'll double click the main CPP file. 149 00:06:04,140 --> 00:06:07,200 And this is actually C code, not C plus plus code. 150 00:06:07,200 --> 00:06:08,520 So we'll delete this in a minute 151 00:06:08,520 --> 00:06:10,410 but that font is a little small. 152 00:06:10,410 --> 00:06:13,016 So in my case, since I'm doing this on video, 153 00:06:13,016 --> 00:06:16,860 I'm gonna go to settings, colors and fonts. 154 00:06:16,860 --> 00:06:19,203 And I'm just gonna set that to about 16. 155 00:06:21,840 --> 00:06:23,043 And let's see. 156 00:06:29,550 --> 00:06:30,383 That's much better. 157 00:06:30,383 --> 00:06:31,900 You should see that much better. 158 00:06:33,000 --> 00:06:34,990 Okay, so let's delete all of this 159 00:06:36,870 --> 00:06:39,870 and we'll write a really simple C plus plus program 160 00:06:39,870 --> 00:06:41,130 as we go through the course. 161 00:06:41,130 --> 00:06:43,890 I'll talk about the anatomy of a C plus plus program 162 00:06:43,890 --> 00:06:44,970 and we'll go into detail 163 00:06:44,970 --> 00:06:46,996 as to what everything I'm gonna be typing here means. 164 00:06:46,996 --> 00:06:48,985 But for now, just type along 165 00:06:48,985 --> 00:06:50,490 and let's get a clean run 166 00:06:50,490 --> 00:06:52,650 so that we know our environments are set up. 167 00:06:52,650 --> 00:06:54,000 So the first thing we wanna write is, 168 00:06:54,000 --> 00:06:56,235 we wanna write pound include 169 00:06:56,235 --> 00:06:59,703 and IO stream inside angle brackets. 170 00:07:01,500 --> 00:07:02,820 Then we'll press enter. 171 00:07:02,820 --> 00:07:07,820 Then we'll say INT, main and open and close parens. 172 00:07:08,730 --> 00:07:10,260 Then we'll create, 173 00:07:10,260 --> 00:07:12,150 then we'll type a left curly 174 00:07:12,150 --> 00:07:13,920 and the integrated development environment 175 00:07:13,920 --> 00:07:15,903 will automatically close that for me. 176 00:07:16,860 --> 00:07:21,860 And here all I wanna do is say STD, two colons, and C out. 177 00:07:23,070 --> 00:07:26,370 Then the insertion operator, which is two less than signs 178 00:07:26,370 --> 00:07:27,700 with no space in between 179 00:07:28,740 --> 00:07:32,640 and just some string saying "Hello testing" 180 00:07:32,640 --> 00:07:34,500 or anything else you like. 181 00:07:34,500 --> 00:07:36,570 That has to be in double quotes. 182 00:07:36,570 --> 00:07:39,000 And then finally we'll put a semicolon on the end of that 183 00:07:39,000 --> 00:07:39,833 to terminate. 184 00:07:40,740 --> 00:07:44,100 And then finally, the last statement will be return zero. 185 00:07:44,100 --> 00:07:46,410 That means that the program terminated correctly. 186 00:07:46,410 --> 00:07:47,243 That's it. 187 00:07:47,243 --> 00:07:50,460 That's our first really simple C plus plus program. 188 00:07:50,460 --> 00:07:52,560 And like I said in the beginning of the course, 189 00:07:52,560 --> 00:07:54,000 I'll go through what all of this means 190 00:07:54,000 --> 00:07:56,880 and we'll go through the anatomy of a C plus plus program 191 00:07:56,880 --> 00:07:58,138 in great detail. 192 00:07:58,138 --> 00:07:59,703 I'll save this. 193 00:08:00,750 --> 00:08:02,520 Another option you may like is, 194 00:08:02,520 --> 00:08:05,640 if you come up here to the menu and you say view 195 00:08:05,640 --> 00:08:08,430 and it'll say toggle minimal view. 196 00:08:08,430 --> 00:08:10,980 And you can see it's putting a bunch of buttons up here. 197 00:08:10,980 --> 00:08:13,590 If you like this, this is great. 198 00:08:13,590 --> 00:08:15,000 Because you know you can run and compile 199 00:08:15,000 --> 00:08:17,132 and do all kinds of things just by clicking on a button. 200 00:08:17,132 --> 00:08:18,720 I'm not gonna use that 201 00:08:18,720 --> 00:08:21,330 because I find that's pretty distracting to the video. 202 00:08:21,330 --> 00:08:22,410 So what I'm going to do is 203 00:08:22,410 --> 00:08:24,270 I'm just gonna shut that off on my end, 204 00:08:24,270 --> 00:08:25,454 but feel free to use it. 205 00:08:25,454 --> 00:08:26,958 I'm gonna use command keys 206 00:08:26,958 --> 00:08:30,270 and I'll also just come up here and say, you know, build. 207 00:08:30,270 --> 00:08:32,159 And that way it's very explicit what I'm doing 208 00:08:32,159 --> 00:08:34,059 rather than just clicking on a button. 209 00:08:35,039 --> 00:08:35,873 So that's it. 210 00:08:35,873 --> 00:08:36,706 So let's run this. 211 00:08:36,706 --> 00:08:39,240 Now what what I'll do is I'll say build. 212 00:08:39,240 --> 00:08:41,640 First thing I want to do is I want to clean this project. 213 00:08:41,640 --> 00:08:44,220 That way there's no remnants of anything left over. 214 00:08:44,220 --> 00:08:45,870 It'll put it into a stable state. 215 00:08:45,870 --> 00:08:46,770 That's good to go. 216 00:08:46,770 --> 00:08:48,123 So I'll clean the project, 217 00:08:48,990 --> 00:08:51,960 all the, any messages will show up down here. 218 00:08:51,960 --> 00:08:55,170 Then I'll say build, and I'll just say run. 219 00:08:55,170 --> 00:08:56,130 And it's going to ask me 220 00:08:56,130 --> 00:08:58,650 do I just wanna run it or do I wanna build it and run it? 221 00:08:58,650 --> 00:09:00,420 Well, in this case, I have to build it and run it 222 00:09:00,420 --> 00:09:01,800 because I haven't built it yet. 223 00:09:01,800 --> 00:09:03,753 So I'll select build and execute. 224 00:09:05,670 --> 00:09:08,790 And if all goes well, we'll get a window that pops up 225 00:09:08,790 --> 00:09:12,450 that says "Hello, testing" exactly what we typed here. 226 00:09:12,450 --> 00:09:14,040 Press any key to continue, oh sorry 227 00:09:14,040 --> 00:09:16,980 press enter to continue, which I'm going to press now. 228 00:09:16,980 --> 00:09:19,230 The window goes away and we're done. 229 00:09:19,230 --> 00:09:21,018 Now several things could go wrong here. 230 00:09:21,018 --> 00:09:23,370 You may have an error in your program. 231 00:09:23,370 --> 00:09:26,070 You might have forgotten to type this exactly right. 232 00:09:26,070 --> 00:09:28,290 So you may have forgotten the semicolon. 233 00:09:28,290 --> 00:09:30,993 In which case when you go to build and run, 234 00:09:35,430 --> 00:09:38,010 you will see this red line here. 235 00:09:38,010 --> 00:09:39,300 That's a compiler error. 236 00:09:39,300 --> 00:09:41,130 You'll also see a red arrow over here 237 00:09:41,130 --> 00:09:43,170 telling you there's something wrong here. 238 00:09:43,170 --> 00:09:44,730 And the compiler's telling you, 239 00:09:44,730 --> 00:09:47,580 it's expecting a semicolon before the return. 240 00:09:47,580 --> 00:09:49,410 So put it in there. 241 00:09:49,410 --> 00:09:50,370 Just be really careful. 242 00:09:50,370 --> 00:09:52,796 I'll talk about debugging and fixing syntax errors 243 00:09:52,796 --> 00:09:54,556 throughout the entire course. 244 00:09:54,556 --> 00:09:57,780 But at this point, save it, make sure it's right. 245 00:09:57,780 --> 00:09:58,980 Again, be very careful. 246 00:09:58,980 --> 00:10:00,109 You may have extra quote marks 247 00:10:00,109 --> 00:10:01,890 and the compiler won't like it. 248 00:10:01,890 --> 00:10:05,310 You might only have a single less than sign here 249 00:10:05,310 --> 00:10:06,240 and it's not gonna like it. 250 00:10:06,240 --> 00:10:09,000 So it's just be sure it's exactly like this. 251 00:10:09,000 --> 00:10:14,000 Once you've got it set up, build, run, build and execute. 252 00:10:15,720 --> 00:10:17,943 There's a clean run and there's my terminal. 253 00:10:19,980 --> 00:10:21,060 Okay, so that's it. 254 00:10:21,060 --> 00:10:23,793 We're all set to learn C plus plus.