1 00:00:05,200 --> 00:00:06,400 Welcome back. 2 00:00:06,400 --> 00:00:09,950 In the last video, I installed CodeLite on Windows 3 00:00:09,950 --> 00:00:13,750 and I created a shortcut icon on my desktop right here. 4 00:00:13,750 --> 00:00:17,750 So if I double click that, that's going to open up and run CodeLite. 5 00:00:17,750 --> 00:00:20,350 And the first time you run it, you're going to get a setup wizard. 6 00:00:20,350 --> 00:00:23,350 It's going to look something like this, it says welcome to the setup wizard, 7 00:00:23,350 --> 00:00:26,350 you can bypass the setup wizard but let's run it. 8 00:00:26,350 --> 00:00:28,040 And we'll select Next 9 00:00:29,400 --> 00:00:31,900 and we'll select C++ development, 10 00:00:33,100 --> 00:00:34,700 select next again. 11 00:00:34,700 --> 00:00:36,060 Now, in this step, 12 00:00:36,060 --> 00:00:37,860 you can scan for compilers. 13 00:00:37,860 --> 00:00:41,120 And the idea here is we've got a compiler installed on our system. 14 00:00:41,120 --> 00:00:45,020 CodeLite needs to configure itself to work with that compiler. 15 00:00:45,020 --> 00:00:47,620 So, we'll select Scan. 16 00:00:47,620 --> 00:00:49,610 Most of the time it will not find it 17 00:00:51,610 --> 00:00:52,970 and in this case, 18 00:00:55,660 --> 00:00:58,060 it did not find, it okay, just like expected. 19 00:00:58,060 --> 00:00:59,260 Do you want to install one? 20 00:00:59,260 --> 00:01:02,060 It thinks we don't have one yet, so don't install anything, 21 00:01:02,060 --> 00:01:04,860 just close this up and we'll manually configure it in a moment. 22 00:01:05,850 --> 00:01:07,850 Don't worry about what shows here, 23 00:01:07,850 --> 00:01:12,540 I've got the Microsoft C++ compiler installed as well along with the 24 00:01:12,540 --> 00:01:14,540 new C++ compiler. 25 00:01:14,540 --> 00:01:18,840 So, most likely, you're only going to see rust so just click Next. 26 00:01:20,040 --> 00:01:23,340 Here we select the colors that we want for our interface. 27 00:01:23,340 --> 00:01:25,640 Normally, I will work in dark. 28 00:01:26,140 --> 00:01:29,140 I'm just going to select System Default because I think that the light 29 00:01:29,140 --> 00:01:31,840 actually I'm going to select light because I think that the light 30 00:01:31,840 --> 00:01:35,940 shows up a lot better on video than the dark, so I'm going to select next. 31 00:01:36,840 --> 00:01:40,340 I'll just press Finish now, don't change any of these settings 32 00:01:40,940 --> 00:01:43,630 and CodeLight is going to close up and restart 33 00:01:45,030 --> 00:01:46,030 and that's it. 34 00:01:46,030 --> 00:01:49,830 So let me make this a little bigger and show you what's going on here. 35 00:01:49,830 --> 00:01:54,030 We've got our menu at the top and over here on the left we've got a workspace view. 36 00:01:54,030 --> 00:01:57,630 In the workspace view is where we see our workspace and our workspace 37 00:01:57,630 --> 00:02:00,320 can consists of many projects 38 00:02:01,220 --> 00:02:03,220 which is really great because we can have 39 00:02:03,220 --> 00:02:06,220 a workspace, for example, for section six 40 00:02:06,220 --> 00:02:09,220 and have all the projects related to section six in here. 41 00:02:09,220 --> 00:02:12,520 Or you can have a workspace named anything you want, maybe you're learning about 42 00:02:12,520 --> 00:02:15,210 pointers and you want to create a workspace called pointers 43 00:02:15,210 --> 00:02:18,810 and then having projects within that workspace all about pointers. 44 00:02:19,310 --> 00:02:23,110 Once you have workspaces, they'll be available down here. 45 00:02:23,110 --> 00:02:27,410 Recently open Workspaces, obviously I've just installed this so I've got nothing in here. 46 00:02:27,410 --> 00:02:31,510 So that's a real easy way to pick previously used workspaces. 47 00:02:31,510 --> 00:02:34,510 And then you see this right over here where it says 48 00:02:34,510 --> 00:02:37,170 open an existing workspace, create a new workspace 49 00:02:37,170 --> 00:02:39,860 and so forth and we'll be using those in just a moment. 50 00:02:39,860 --> 00:02:42,860 But before we do anything, we need to set up 51 00:02:42,860 --> 00:02:46,460 and configure our compiler, so let's do that. 52 00:02:46,460 --> 00:02:50,860 I'm going to go up here to Settings and then I'm going to press Build Settings 53 00:02:51,860 --> 00:02:56,220 and there you can see those three items that we saw a little while ago during our build. 54 00:02:56,220 --> 00:03:00,020 Now at this point, I want to click that blue plus symbol right here. 55 00:03:00,420 --> 00:03:03,720 On some versions, I think it's the Linux version of the Mac version, 56 00:03:03,720 --> 00:03:06,720 that's a green plus, but in this case, it's a blue plus. 57 00:03:06,720 --> 00:03:10,020 So, I'm going to make sure, I'm on that compilers tab right up here 58 00:03:10,020 --> 00:03:13,520 and I'm going to click that plus it says add an existing compiler, 59 00:03:13,520 --> 00:03:14,520 so I'm going to click it. 60 00:03:15,120 --> 00:03:17,810 Now, I'm going to go to where I installed my compiler 61 00:03:17,810 --> 00:03:20,010 and I installed it on my C drive 62 00:03:20,010 --> 00:03:22,810 in the mingw folder, right there, 63 00:03:23,610 --> 00:03:27,410 and I want to select the bin, that's the path that I want. 64 00:03:27,410 --> 00:03:31,210 That's where all my binaries are, the executable files for the compiler 65 00:03:31,210 --> 00:03:32,710 and I'm going to select folder. 66 00:03:32,710 --> 00:03:36,010 At this point, it's asking us to name the compiler. 67 00:03:36,510 --> 00:03:38,870 I'm going to name it MinGW, just like that. 68 00:03:41,070 --> 00:03:45,430 I encourage you to do the same, select OK. 69 00:03:45,430 --> 00:03:48,930 And now, CodeLite has set up the compiler, you can see it, 70 00:03:48,930 --> 00:03:52,430 set up the compiler path, the assembler paths and all this good stuff. 71 00:03:52,430 --> 00:03:55,420 And a good sanity check is to look through here 72 00:03:55,420 --> 00:03:59,620 and make sure that you've got MinGW 64 bin because that's where all this stuff is. 73 00:04:00,060 --> 00:04:03,620 And once we're done with that, we can click OK, great. 74 00:04:03,620 --> 00:04:07,620 Now, we're in a position where we can start writing code, 75 00:04:07,620 --> 00:04:10,520 creating workspaces, creating projects and so forth, 76 00:04:10,520 --> 00:04:11,880 so let's screw through those steps. 77 00:04:11,880 --> 00:04:15,180 There's still a little bit more configuration, but not a lot more. 78 00:04:15,180 --> 00:04:16,779 So, what we can do here? 79 00:04:17,279 --> 00:04:19,279 Is we don't have any workspaces yet, 80 00:04:19,279 --> 00:04:21,480 so we can create a new workspace. 81 00:04:21,480 --> 00:04:24,380 I can click over here on this big button over here on the right, 82 00:04:24,380 --> 00:04:26,980 or I can go up to workspace, new workspace, 83 00:04:27,480 --> 00:04:30,280 and I think you can even do a file, New Workspace, 84 00:04:30,280 --> 00:04:31,480 yes, right there. 85 00:04:31,480 --> 00:04:33,480 So, there's a lot of different ways to do it. 86 00:04:33,480 --> 00:04:35,980 I'm just going to click on this big button because it's pretty easy. 87 00:04:36,980 --> 00:04:40,080 Now, it's asking us what type of workspace do we want? 88 00:04:40,080 --> 00:04:42,280 We want a C++ workspace, 89 00:04:42,280 --> 00:04:45,580 so make sure you select C++, click OK. 90 00:04:47,180 --> 00:04:50,480 So now, it's asking us where do you want to store this workspace? 91 00:04:51,170 --> 00:04:52,670 So here, you've got a lot of choices. 92 00:04:52,670 --> 00:04:55,360 You can store this wherever you like, sort of, 93 00:04:55,360 --> 00:04:57,860 do not install this on cloud drives, 94 00:04:57,860 --> 00:05:02,550 do not install workspaces on folders with really weird names. 95 00:05:02,550 --> 00:05:06,850 And the other thing I would recommend is not to install it on your desktop or your documents. 96 00:05:06,850 --> 00:05:09,210 I used to do that all the time and it worked great, 97 00:05:09,210 --> 00:05:12,710 but more and more we have systems that are using OneDrive 98 00:05:12,710 --> 00:05:15,310 and OneDrive is managing the desktop 99 00:05:15,310 --> 00:05:18,310 and the documents folders and it's putting them somewhere else where they 100 00:05:18,310 --> 00:05:19,560 normally aren't. 101 00:05:19,560 --> 00:05:22,860 So what I would recommend is that we go right in here 102 00:05:22,860 --> 00:05:26,860 right in our users and whatever your username is, my name is Mitro 103 00:05:26,860 --> 00:05:29,550 in this example, that's going to be your own username. 104 00:05:29,550 --> 00:05:31,050 What I encourage you to do? 105 00:05:31,050 --> 00:05:33,550 Is just click those three little buttons here. 106 00:05:33,550 --> 00:05:35,550 And right now, I'm in the home folder, 107 00:05:35,550 --> 00:05:37,910 and right in here, I want to create a new folder 108 00:05:38,410 --> 00:05:40,910 and I'm just going to call this Workspaces. 109 00:05:43,810 --> 00:05:46,110 Just like that, and I'm going to select that. 110 00:05:47,010 --> 00:05:50,470 So, my workspace path is my 111 00:05:50,470 --> 00:05:53,770 home directory, my user's username folder, 112 00:05:53,770 --> 00:05:56,970 and I want to create a new workspace, so let's call this workspace one. 113 00:05:58,470 --> 00:06:01,470 We can call it, whatever we want.We can call it, you know, 114 00:06:01,870 --> 00:06:03,870 this week's workspace, whatever you like. 115 00:06:03,870 --> 00:06:06,170 Now, what something that's very important? 116 00:06:06,770 --> 00:06:09,270 Do not put spaces anywhere. 117 00:06:09,270 --> 00:06:14,770 Do not use special characters, just keep it really, really simple. 118 00:06:14,970 --> 00:06:18,970 No international characters, no spaces, no special characters, 119 00:06:18,970 --> 00:06:20,970 just keep it plain and simple, 120 00:06:20,970 --> 00:06:24,970 these build tools are really, really picky about that, so that's my workspace. 121 00:06:25,570 --> 00:06:29,560 Make sure that create the workspace under a separate directory is checked 122 00:06:29,560 --> 00:06:30,860 and click OK. 123 00:06:31,460 --> 00:06:35,150 Now, you can see over here on the left that we've got a new workspace that's been created. 124 00:06:35,750 --> 00:06:37,950 And that's great, that's exactly what we want. 125 00:06:37,950 --> 00:06:40,950 But we need projects within that workspace. 126 00:06:40,950 --> 00:06:44,850 And the projects themselves are each going to be a C++ program. 127 00:06:45,650 --> 00:06:47,550 So how do you think we create a project? 128 00:06:47,550 --> 00:06:48,550 Really easy. 129 00:06:48,550 --> 00:06:53,240 Click on your workspace, you can come up to file, new project. 130 00:06:53,840 --> 00:06:56,140 Or we can right click on the workspace 131 00:06:56,140 --> 00:06:58,740 and create a new project, that's what I'm going to do. 132 00:06:59,640 --> 00:07:02,640 Now, we're going to get a new project wizard. 133 00:07:02,640 --> 00:07:05,940 Notice the path is the workspace one that we created. 134 00:07:05,940 --> 00:07:08,240 Now it's asking us what's the name of your project? 135 00:07:08,240 --> 00:07:10,740 I'm just going to call it Project One. 136 00:07:10,740 --> 00:07:14,730 Remember, we can have as many projects as we'd like within that workspace. 137 00:07:14,730 --> 00:07:18,230 Make sure create the project in its own folder is checked. 138 00:07:18,230 --> 00:07:21,230 And now, these are really important settings here, what's the category? 139 00:07:21,230 --> 00:07:24,430 We want to build a console-based application. 140 00:07:24,430 --> 00:07:28,930 That's an application that runs in a console window, a command prompt window. 141 00:07:28,930 --> 00:07:32,530 We're not doing graphical user interfaces, that would be a whole different course. 142 00:07:33,130 --> 00:07:34,130 The type 143 00:07:34,630 --> 00:07:37,930 is going to be simple executable G++. 144 00:07:38,530 --> 00:07:41,630 Now it's asking us, what compiler did we install? 145 00:07:41,630 --> 00:07:46,630 Well, we installed the MinGW compiler, that's the one that we installed a minute ago and named it, 146 00:07:46,630 --> 00:07:47,990 so I'm going to select that. 147 00:07:47,990 --> 00:07:51,890 For debugger, you can choose the GNU gdb debugger. 148 00:07:52,890 --> 00:07:54,490 And now for the build system. 149 00:07:54,490 --> 00:07:58,090 This is where the developer that created CodeLite, 150 00:07:58,090 --> 00:08:00,780 really changed things up in 17.3. 151 00:08:00,780 --> 00:08:05,080 For years there has been a default build system in here that worked great, 152 00:08:05,080 --> 00:08:09,880 he got rid of the default build system, I don't know why, but he did. 153 00:08:09,880 --> 00:08:11,880 So, we have to work without that now. 154 00:08:11,880 --> 00:08:13,380 And what we're going to choose is? 155 00:08:13,380 --> 00:08:15,880 CodeLite make file generator. 156 00:08:15,880 --> 00:08:21,180 Let me click those again and it should just be there when you start but just to be sure. 157 00:08:21,180 --> 00:08:23,680 You've got a couple of options here, 158 00:08:23,680 --> 00:08:26,580 CodeLite make file generator is what we want. 159 00:08:26,580 --> 00:08:30,180 So that's the one I'm going to choose and I'm going to click OK. 160 00:08:31,870 --> 00:08:35,870 Now, we've got a project over here, it's got a source folder. 161 00:08:35,870 --> 00:08:37,470 That's where we're going to put our source code. 162 00:08:37,470 --> 00:08:40,270 And it's got a main.cpp file. 163 00:08:40,270 --> 00:08:44,630 The main.cpp file is RC++ source code 164 00:08:44,630 --> 00:08:47,230 and the name of the file is main.cpp. 165 00:08:47,230 --> 00:08:51,130 So, let me double click that and that's going to open it up here 166 00:08:51,130 --> 00:08:52,730 in my editor. 167 00:08:52,730 --> 00:08:56,030 This is where I can change my program, add code and so forth. 168 00:08:56,030 --> 00:08:59,030 I'm going to go to my settings for a minute 169 00:08:59,030 --> 00:09:01,420 and I'm going to go to my colors and fonts and I'm just going to make this 170 00:09:01,420 --> 00:09:04,420 font a little bit bigger, just so it's easier for you all to see. 171 00:09:04,420 --> 00:09:05,720 You don't have to do this, 172 00:09:05,720 --> 00:09:09,410 but I think it's going to make a big difference here, there we go. 173 00:09:09,410 --> 00:09:11,610 So now, what we're going to do is? 174 00:09:11,610 --> 00:09:15,110 We're just going to get rid of all this, because that's really c like code. 175 00:09:15,110 --> 00:09:16,710 Now you'll notice what happened? 176 00:09:16,710 --> 00:09:20,400 When I got rid of that, you'll notice that red dot that came right up here. 177 00:09:20,400 --> 00:09:24,300 That means that whatever changes I've made to this file, I have not saved. 178 00:09:24,900 --> 00:09:29,500 So we can save what we've done by just going to file, save file or control S 179 00:09:29,500 --> 00:09:30,500 on Windows. 180 00:09:31,400 --> 00:09:35,700 It's really important that we always save before we try to build and run anything. 181 00:09:36,300 --> 00:09:40,500 So in this case, let's start writing a real simple Hello World program. 182 00:09:40,500 --> 00:09:43,500 First thing we're going to do is pound include 183 00:09:44,100 --> 00:09:46,400 and we're going to say io stream 184 00:09:46,400 --> 00:09:48,400 inside angle brackets. 185 00:09:49,300 --> 00:09:52,300 Then I'm going to type using namespace 186 00:09:52,800 --> 00:09:55,800 std followed by a semicolon. 187 00:09:55,800 --> 00:09:59,000 At this point, just type along and follow along, 188 00:09:59,000 --> 00:10:01,200 all this is going to be explained in the course. 189 00:10:01,200 --> 00:10:03,800 And now, we need to write a main function. 190 00:10:03,800 --> 00:10:07,160 This is the place where our program is going to begin executing, 191 00:10:07,160 --> 00:10:11,520 so we're going to type in int space, main, 192 00:10:11,520 --> 00:10:13,920 left paren, right paren, 193 00:10:13,920 --> 00:10:16,420 then we're going to have a left curly brace. 194 00:10:16,420 --> 00:10:21,110 And you'll notice when I pressed enter CodeLite automatically closed that for me. 195 00:10:21,110 --> 00:10:24,110 So it's using those smart braces, which is really, really handy. 196 00:10:24,610 --> 00:10:28,210 And in here, all we're going to say is c out, 197 00:10:30,210 --> 00:10:33,410 two less than signs or left angle brackets 198 00:10:33,410 --> 00:10:36,010 side by side with no space between them. 199 00:10:36,010 --> 00:10:39,610 Make sure there is a space between c out and those angle brackets. 200 00:10:39,610 --> 00:10:41,210 Then again, another space. 201 00:10:41,510 --> 00:10:43,710 And then, I'm going to type Hello World 202 00:10:45,030 --> 00:10:47,330 in double quotes, just like that. 203 00:10:48,230 --> 00:10:50,590 Then I'm going to follow that with two more 204 00:10:50,590 --> 00:10:53,280 left angle brackets or two less than signs, 205 00:10:53,280 --> 00:10:56,880 followed by the word endl, 206 00:10:56,880 --> 00:10:59,880 not end1, but endl. 207 00:10:59,880 --> 00:11:02,080 Now, you'll notice as I was typing, 208 00:11:02,080 --> 00:11:04,980 CodeLite was helping me, it's got code completion. 209 00:11:04,980 --> 00:11:09,180 So it's helping me and I'm just going to indent this so it all lines up nicely. 210 00:11:09,180 --> 00:11:11,180 It's trying to figure out, what I want to type next 211 00:11:11,180 --> 00:11:14,870 and helping me out so I could just press tab and I don't have to type it all in. 212 00:11:14,870 --> 00:11:19,070 So in this case, we have one more statement to write, it's going to be return. 213 00:11:19,070 --> 00:11:22,870 And you can see, when I type ret, it's giving me the return. 214 00:11:22,870 --> 00:11:27,470 So I could just press tab and it'll finish it for me, return zero, 215 00:11:27,470 --> 00:11:30,870 with a space between the return of the zero and a semicolon. 216 00:11:30,870 --> 00:11:31,470 That's it. 217 00:11:31,470 --> 00:11:33,470 This is our first program. 218 00:11:33,470 --> 00:11:36,370 Why do we write a Hello World program? 219 00:11:36,370 --> 00:11:39,670 Well, it's become the norm and the reason we do it is, 220 00:11:39,670 --> 00:11:42,360 if we see Hello World display when we run this, 221 00:11:42,360 --> 00:11:45,960 we know that our development environment has been set up correctly 222 00:11:45,960 --> 00:11:49,860 and it's a pretty easy way to do it. Now you'll notice I am still red here. 223 00:11:50,760 --> 00:11:54,260 So, I want to press CTRL S or file save. 224 00:11:54,260 --> 00:11:58,860 I'm going to press CTRL S and that has now changed to that little X there. 225 00:11:59,760 --> 00:12:02,760 Now you'll notice these red arrows popping up. 226 00:12:02,760 --> 00:12:06,660 Don't worry about those, those will go away in a second when we do the build. 227 00:12:06,660 --> 00:12:09,960 But before we do the build, we need to configure our compiler. 228 00:12:10,560 --> 00:12:12,360 So, what we can do is? 229 00:12:12,360 --> 00:12:15,660 Remember, it's possible that we have a lot of projects in here. 230 00:12:15,660 --> 00:12:19,350 There's only going to be one active project at a time and that's the one that's 231 00:12:19,350 --> 00:12:23,250 bold and italicized, and there's only one right now but you can see it right here. 232 00:12:23,850 --> 00:12:27,650 You can always right click on that and make it active. 233 00:12:28,250 --> 00:12:32,050 And by double clicking on it, you can choose which project you want to build. 234 00:12:32,050 --> 00:12:34,550 Again, we can have 20, 30 projects, 235 00:12:34,550 --> 00:12:36,910 we just double click them, that's the one we want. 236 00:12:36,910 --> 00:12:38,910 So let's configure this project. 237 00:12:38,910 --> 00:12:41,810 So make sure that you've selected Project One. 238 00:12:41,810 --> 00:12:44,710 Then I'm going to come up to this wrench icon right here 239 00:12:44,710 --> 00:12:46,710 that gives us our project settings. 240 00:12:46,710 --> 00:12:48,210 You can also right click 241 00:12:48,210 --> 00:12:51,510 and come down to settings, you can see the wrench icon there. 242 00:12:52,010 --> 00:12:54,210 So again, I'm going to just click that icon. 243 00:12:54,210 --> 00:12:56,710 And now, we get this project settings menu. 244 00:12:57,310 --> 00:13:00,000 I know this looks like a lot to do right now 245 00:13:00,000 --> 00:13:03,200 and it is in a sense but in a while, we won't have 246 00:13:03,200 --> 00:13:06,200 to do any of this because we're going to create a template project 247 00:13:06,200 --> 00:13:10,600 that we can create new projects from and I'll do that in a couple of videos from now 248 00:13:10,600 --> 00:13:12,600 which makes it really easy to do. 249 00:13:12,600 --> 00:13:14,600 So, what do we have here? 250 00:13:14,600 --> 00:13:18,100 These are some of the options that I selected in that new Project wizard. 251 00:13:18,100 --> 00:13:22,460 There's the CodeLite Make File Generator, the MinGW. 252 00:13:22,460 --> 00:13:23,460 So what we want to do here is? 253 00:13:23,460 --> 00:13:25,460 We want to make one change to this. 254 00:13:25,460 --> 00:13:27,150 We want to delete 255 00:13:27,150 --> 00:13:29,350 the working directory right here, 256 00:13:30,950 --> 00:13:32,950 the whole thing, I just want to delete it all 257 00:13:33,640 --> 00:13:36,840 and I want to type in dollar and then 258 00:13:36,840 --> 00:13:39,200 left parent, Project 259 00:13:39,200 --> 00:13:41,700 Path right parent, just like that. 260 00:13:41,700 --> 00:13:44,700 So, you should have a dollar sign, a left paren, 261 00:13:44,700 --> 00:13:48,300 Project Path and a right closing parenthesis. 262 00:13:48,300 --> 00:13:51,900 Make sure that the two P's in Project Path are capitalized. 263 00:13:52,890 --> 00:13:53,790 That's it. 264 00:13:54,590 --> 00:13:58,190 We press tab and you can see it light up like that, I'm going to apply 265 00:13:59,090 --> 00:14:01,090 and I'm going to select OK. 266 00:14:01,450 --> 00:14:04,650 Okay now that basically set up our environment. 267 00:14:04,650 --> 00:14:06,150 Now what we want to do is? 268 00:14:06,150 --> 00:14:07,950 We want to set up the compiler option. 269 00:14:07,950 --> 00:14:12,310 So again, I didn't have to leave that one with okay, but you could just open it again. 270 00:14:12,310 --> 00:14:15,000 And now, we're going to select the compiler right up here 271 00:14:17,000 --> 00:14:20,800 and you can see I've got a C++ compiler and a C compiler, 272 00:14:20,800 --> 00:14:25,000 we're only working with a C++ compiler, so I want to set some options for that. 273 00:14:25,000 --> 00:14:27,360 You can see there's already a few options set here, 274 00:14:27,360 --> 00:14:30,360 gdwarf and a capital O and a wall and I'll let explain 275 00:14:30,360 --> 00:14:31,660 as the course goes on. 276 00:14:31,660 --> 00:14:32,660 So click here 277 00:14:33,350 --> 00:14:37,350 and you'll see these three little dots that pop up right here in a button. 278 00:14:37,350 --> 00:14:39,850 So we're going to select that and now, 279 00:14:39,850 --> 00:14:43,150 we've got a whole bunch of options that we can select from. 280 00:14:43,150 --> 00:14:46,150 We're only going to select one more and that's that one right here. 281 00:14:46,150 --> 00:14:49,750 Enable C++ 17 features, 282 00:14:49,750 --> 00:14:52,750 there's two of them, but make sure you select the one that says dash 283 00:14:52,750 --> 00:14:54,850 std equals C++ 17. 284 00:14:54,850 --> 00:14:56,650 And you can see down here in the command line, 285 00:14:56,650 --> 00:15:00,340 those are the commands that are going to be used by the compiler to build the program. 286 00:15:00,940 --> 00:15:06,240 Now, I'm going to select OK, apply, OK, now we're done. 287 00:15:06,930 --> 00:15:08,130 Now what we can do is? 288 00:15:08,130 --> 00:15:10,130 We can build and run this program. 289 00:15:10,130 --> 00:15:11,630 So how do we do that? 290 00:15:12,030 --> 00:15:15,030 Make sure that your project, you want to run is the active project. 291 00:15:15,030 --> 00:15:18,830 Again, in this case, there's only one project we can come up to build, 292 00:15:19,720 --> 00:15:21,320 we can do a build. 293 00:15:21,320 --> 00:15:24,120 There's a lot of options here that I'll explain as we go. 294 00:15:24,120 --> 00:15:26,120 But we can select rebuild project 295 00:15:27,320 --> 00:15:31,920 and we get the output window come up down here, let me just move this up a little bit. 296 00:15:32,280 --> 00:15:34,640 This is the build output right here 297 00:15:34,640 --> 00:15:38,940 and you can see that it successfully has created a program 298 00:15:39,540 --> 00:15:40,900 which is pretty cool. 299 00:15:40,900 --> 00:15:43,400 Now, what we can do is? We can run this program. 300 00:15:43,700 --> 00:15:46,700 So, let me close that and I'm going to select 301 00:15:46,700 --> 00:15:48,900 Build run 302 00:15:48,900 --> 00:15:52,500 it's going to ask me, you want to build it and execute it or just execute it? 303 00:15:52,500 --> 00:15:54,700 I just want to execute it because I've already built it. 304 00:15:56,900 --> 00:15:59,400 A window pops up and it says Hello World. 305 00:16:00,200 --> 00:16:02,700 This tells you that your build environment is set up, 306 00:16:02,700 --> 00:16:05,700 your compiler is set up, everything's working, everything looks good. 307 00:16:05,700 --> 00:16:07,900 Now, all we displayed was Hello World. 308 00:16:07,900 --> 00:16:10,500 The rest of this stuff is displayed by CodeLite. 309 00:16:11,000 --> 00:16:15,400 It tells you that your program exited with an exit code of zero, that is a good thing. 310 00:16:15,400 --> 00:16:19,000 An exit code of zero means that your program ran successfully. 311 00:16:19,000 --> 00:16:22,000 That's basically what we're returning that zero right here for. 312 00:16:22,800 --> 00:16:26,790 And again, we'll explain all this as we go. Right now, we're just trying to get the environment set up. 313 00:16:27,290 --> 00:16:29,490 We're displaying Hello World, we're returning that zero, 314 00:16:29,490 --> 00:16:31,690 everything worked, there was no other error. 315 00:16:31,690 --> 00:16:34,690 How much time did the program take to run? 316 00:16:34,990 --> 00:16:38,490 There you see it, and then it says press any key to continue and if I press Enter, 317 00:16:39,290 --> 00:16:40,650 the window goes away. 318 00:16:41,150 --> 00:16:45,450 So that's it. We've built our first program, it was pretty easy I think. 319 00:16:45,450 --> 00:16:48,050 It's just a matter of setting these little steps up, 320 00:16:48,050 --> 00:16:50,050 so let me create another project 321 00:16:50,050 --> 00:16:51,950 and I'm going to use this same source code. 322 00:16:52,850 --> 00:16:56,750 And I'm just going to copy that so I don't have to type it in again, I'm just using CTRL C. 323 00:16:56,750 --> 00:17:00,440 And I can close this window down here just to reduce some of the clutter. 324 00:17:00,440 --> 00:17:02,040 So what do I want to do now? 325 00:17:02,040 --> 00:17:06,040 Well, I want to click on the workspace, right click, New project. 326 00:17:09,040 --> 00:17:13,030 And my project name is Project Two. 327 00:17:13,829 --> 00:17:17,130 I'm going to remember the life setting, so it's a console-based program. 328 00:17:17,130 --> 00:17:19,819 It's simple, executable MinGW, 329 00:17:19,819 --> 00:17:22,420 the GNU debugger and CodeLite make file generator. 330 00:17:23,220 --> 00:17:24,220 I'll select OK. 331 00:17:25,020 --> 00:17:27,920 Once that's done, I've got my main. 332 00:17:27,920 --> 00:17:29,920 And notice I've got two mains now, right? 333 00:17:29,920 --> 00:17:32,920 Project One has a main, which is this one. 334 00:17:32,920 --> 00:17:35,520 And project Two has a main, which is this one. 335 00:17:35,520 --> 00:17:38,420 So I'm just going to get rid of this and copy what I did, 336 00:17:38,420 --> 00:17:42,620 I'm going to say Hello World, from Project Two, 337 00:17:43,620 --> 00:17:44,220 like that. 338 00:17:44,220 --> 00:17:46,820 Notice that's red up here, so I want to save it. 339 00:17:48,420 --> 00:17:50,620 You'll notice Project One is the active project, 340 00:17:50,620 --> 00:17:54,820 you see how it's bold and italicized, I can just double click on Project Two. 341 00:17:54,820 --> 00:17:58,180 And now Project Two is the one that's bold and italicized right there, 342 00:17:58,180 --> 00:17:59,580 so it's the active project. 343 00:17:59,580 --> 00:18:03,180 So when I build and run Project Two is the one that's going to be affected. 344 00:18:03,870 --> 00:18:06,670 So, I'm going to click the wrench again 345 00:18:07,670 --> 00:18:10,270 and I'm going to go up to my general options, 346 00:18:11,070 --> 00:18:12,370 I'm going to get rid of this. 347 00:18:12,370 --> 00:18:15,170 And again, like I said, we're not going to have to do this every time, 348 00:18:15,170 --> 00:18:18,970 but we're just going to do it this time, I'm going to create Project Path. 349 00:18:20,660 --> 00:18:25,260 Be really careful here, I didn't put a capital P and it must be a capital P, 350 00:18:25,260 --> 00:18:26,260 just like that. 351 00:18:26,260 --> 00:18:27,860 Then I'm going to compiler 352 00:18:28,860 --> 00:18:33,460 and I'm going to come right over here and I'm going to add these to equal C++ 17, 353 00:18:35,460 --> 00:18:36,360 just like that. 354 00:18:36,960 --> 00:18:40,560 You might want to select the linker and type dash static, 355 00:18:41,920 --> 00:18:43,220 that's up to you. 356 00:18:43,220 --> 00:18:46,420 I would recommend you do so because it's going to avoid 357 00:18:46,420 --> 00:18:49,780 problems with finding DLLs and windows and so forth. 358 00:18:49,780 --> 00:18:52,470 So all you have to do is just click on the linker options and type 359 00:18:52,470 --> 00:18:54,830 dash static or hyphen static. 360 00:18:54,830 --> 00:18:59,830 All one word, no spaces, we'll click apply, we'll click OK, 361 00:19:00,830 --> 00:19:02,630 and that's it, we're ready to build. 362 00:19:02,630 --> 00:19:04,320 So now, I'm going to go to build, 363 00:19:05,320 --> 00:19:06,320 rebuild Project, 364 00:19:08,010 --> 00:19:08,510 there we go. 365 00:19:08,510 --> 00:19:11,310 We have a clean build, and if we run, 366 00:19:12,300 --> 00:19:14,500 it's going to say hello from Project Two. 367 00:19:16,500 --> 00:19:19,500 And that's exactly what we see here, Hello World from Project Two. 368 00:19:21,400 --> 00:19:22,000 Pretty good. 369 00:19:22,500 --> 00:19:23,700 All right. 370 00:19:24,600 --> 00:19:26,800 So, if you have build errors, it's possible. 371 00:19:26,800 --> 00:19:29,800 We get build errors every day, right? So here's an example. 372 00:19:29,800 --> 00:19:31,700 I spelled this wrong. 373 00:19:31,700 --> 00:19:36,060 Instead of io stream, I wrote io steam. 374 00:19:36,750 --> 00:19:40,440 And now, these red arrows are coming back up saying iosteam file not 375 00:19:40,440 --> 00:19:41,540 found and so forth. 376 00:19:41,540 --> 00:19:45,740 So these things kind of help you before we build, to let us know something's not right. 377 00:19:45,740 --> 00:19:47,100 But if I do try to build my project, 378 00:19:47,100 --> 00:19:49,300 you see I'm going to get errors here. 379 00:19:49,300 --> 00:19:53,560 It's going to go io steam, and it's going to say no such file or directory, 380 00:19:53,560 --> 00:19:55,760 it's kind of telling you something's not right. 381 00:19:56,360 --> 00:19:59,960 And we've got an error message down here, the build ended with errors. 382 00:19:59,960 --> 00:20:02,860 So when that happens, we know we've got a problem. 383 00:20:02,860 --> 00:20:06,360 If you run into things like this, they're usually pretty easy fixes, 384 00:20:06,360 --> 00:20:08,660 a lot of times it's just typos, right? 385 00:20:08,660 --> 00:20:12,350 So if I put that back in and build, we'll be good to go. 386 00:20:12,350 --> 00:20:15,950 But if you post something on the Q&A about it and I'll say, 387 00:20:15,950 --> 00:20:19,940 rebuild your project and show me the build output, this is what I want to see down here. 388 00:20:19,940 --> 00:20:22,140 So, we've got several tabs here. 389 00:20:22,140 --> 00:20:24,140 So, you would just click the build tab 390 00:20:24,140 --> 00:20:28,040 and copy and paste all this stuff or give me a screenshot and I can really help you with that. 391 00:20:28,640 --> 00:20:31,840 Similarly, if we let me close this, we get a new one. 392 00:20:31,840 --> 00:20:35,440 If I forgot that semicolon, semicolons are really important. 393 00:20:35,740 --> 00:20:38,100 You can see that little red arrow is popping up saying, 394 00:20:38,100 --> 00:20:42,000 hey, I expected a semicolon somewhere, right after here. 395 00:20:42,000 --> 00:20:43,300 But if I do build, again, 396 00:20:45,600 --> 00:20:48,900 I'm going to get an error right there, it's pointing at it, it says, hey, 397 00:20:48,900 --> 00:20:50,260 I'm expecting a semicolon. 398 00:20:50,260 --> 00:20:53,950 We can't run our program until we get a clean build 399 00:20:53,950 --> 00:20:56,450 so I can put the semicolon back in. 400 00:20:56,450 --> 00:20:59,750 And as you can imagine, there's a lot of places to make mistakes, right? 401 00:20:59,750 --> 00:21:03,550 I spell main wrong, I forget one of these quotes here, 402 00:21:03,550 --> 00:21:06,550 we have to close them up a whole bunch of places, 403 00:21:06,550 --> 00:21:08,550 I forget this closing curly. 404 00:21:09,150 --> 00:21:11,250 So there are a lot of places where things can go wrong. 405 00:21:11,250 --> 00:21:15,400 But once you have this environment set up and you've got a build, 406 00:21:15,400 --> 00:21:19,000 we're good to go, we can proceed and we can write code in the course. 407 00:21:19,000 --> 00:21:24,300 Now, the last thing I'd like you to do is come up to settings, 408 00:21:25,100 --> 00:21:27,400 preferences and come over here to where it says miscellaneous 409 00:21:28,300 --> 00:21:32,200 and it says check for new version on startup and just unclick that, 410 00:21:32,200 --> 00:21:36,100 otherwise it's going to really pester you a lot saying, hey, there's a new version of codeLite out there. 411 00:21:37,000 --> 00:21:40,900 Resist the urge to download and install new versions. 412 00:21:40,900 --> 00:21:45,300 New versions often come with bugs, often come with a lot of changes. 413 00:21:45,300 --> 00:21:48,600 Once you have your development environment set up for this course, 414 00:21:48,600 --> 00:21:49,300 just leave it alone. 415 00:21:49,300 --> 00:21:52,760 Use it that way for the whole course and you're not going to have it any trouble. 416 00:21:52,760 --> 00:21:56,060 Don't just keep updating at every point release because that's 417 00:21:56,060 --> 00:21:59,420 just asking for trouble and for misconfiguration errors. 418 00:21:59,420 --> 00:22:03,220 Okay, so I'm going to click apply and okay, 419 00:22:03,720 --> 00:22:05,720 and we're pretty much done. 420 00:22:05,720 --> 00:22:08,720 So if you've gotten this far and you've got your build system all set up, 421 00:22:08,720 --> 00:22:10,920 congratulations, we're good to go. 422 00:22:10,920 --> 00:22:13,920 Next step is to head over to the 423 00:22:13,920 --> 00:22:17,610 video where I'm going to show you how to set up a project template 424 00:22:17,610 --> 00:22:19,610 so that you don't have to go through all the stuff that I just 425 00:22:19,610 --> 00:22:21,610 went through, we only have to do it once. 426 00:22:21,610 --> 00:22:24,610 And then from that point forward, we just create a new project 427 00:22:24,610 --> 00:22:26,610 based on an existing project 428 00:22:26,610 --> 00:22:31,300 and all this project path and all of this compiler stuff and all of this 429 00:22:31,300 --> 00:22:34,200 linker stuff is going to be done for us automatically, 430 00:22:34,200 --> 00:22:35,800 so we don't have to do that again. 431 00:22:35,800 --> 00:22:37,400 All right, so I'll see you in that video.