(bright music)
(keyboard clicking)
Frank: In this video,
we're going to configure the CodeLite IDE
that we just installed
to work on our Windows system with C++.
So the first thing we wanna do is we wanna start CodeLite,
so I'm just gonna double click on the icon.
And the first time that you run CodeLite,
you'll probably get a little setup wizard popup.
And here it is.
You may also get a window that says,
"Do you want to update to the latest version,"
which you can certainly do.
I'm gonna cancel for this video.
And here's the setup wizard.
Now it's important that you run through this setup wizard.
If this does not show up for the first time,
you can always find it up here, you can select help,
and then you can run the setup wizard here.
But in this case it does show up.
So I'm gonna go through this,
and you only have to do this one time.
I'm gonna select next.
Now here, the way that CodeLite works
is it uses a lot of plugins to support PHP,
C, C++ and so forth.
We only care about C++ in this case.
So what we want to do is we want to clear these plugins.
So you can see all the check marks are gone.
And then we wanna toggle the C++ plugins only.
So I'm gonna select that until only the C++ ones show up.
Okay? So that's what we need to do.
Just make sure that not all of them are set up,
just some of them, you can use the toggle to do it.
I'll select next.
Now we wanna set up the compiler.
Now remember, if you've already installed
the MinGW compiler, then you can just click scan.
If you haven't, go back to the video and install it.
I wouldn't install it from this option,
'cause it installs an older version of the MinGW compiler.
So I'm going to scan, and it should find it, there it is.
So I wanna select it, and press next.
Now here you can customize the colors to whatever you like.
This dark Monokai theme is kind of nice on the vision,
it's not so hard on your eyes.
For the video I'm going to choose the classic Eclipse look.
That way I think it shows up a little better on video.
So I'll select next.
We'll leave these defaults as-is, and we'll press finish.
Now at this point you want to save and exit.
It's gonna ask you this every time you make a change,
and it gets pretty annoying.
So I'm just gonna say,
remember my answer and don't ask me again.
And every time I make a change, I wanna save and exit,
so I'll save and exit.
Okay, so it saves it, and it opens it up again,
and now the settings that I set were applied.
And again, I'll cancel the new download here.
Okay, so let me make this full screen here.
And as I mentioned before,
if that setup wizard does not show up,
you can start it here.
Run the setup wizard.
Okay, so now, what we want to do
is we wanna create a new workspace.
And once we create the new workspace,
we'll have a couple settings to do,
and then once that's done, it'll be all set.
So let's create a new workspace.
A workspace is basically an area
where you can have different C++ projects in.
So the first thing we wanna do is create a new workspace.
I'll select that.
You can also say file, new workspace.
Okay, so I'll do it right here.
And it's gonna ask me for the name of the workspace.
So I'll just say, CPP Workspace.
You could do this whatever you like, if you want to have,
you know, a workspace for all the section one exercises,
section two, section three, or whatever you like,
whatever makes sense for you.
I'm going to put it in my documents folder,
and I wanna create the workspace under a separate directory,
that just helps me organize my files.
I'll select okay.
Good, now you can see here on the left pane
on my workspace view, I've got a workspace.
Now the workspace in and of itself isn't real useful.
I need to create a project within the workspace.
So I can right click on workspace and say new project.
So I'll do that and I'll select new project.
At this point, we've got some options.
We're going to select the console option,
and then simple executable G++.
That's basically the C++ compiler.
It's called G++ because it's from GNU.
So I'll select that next.
And then you give your project a name.
This could be again, any name you like.
Avoid spaces just to be safe, just simple name.
So I'll say Test1, let's say.
And again, I wanna create a project under,
in a separate directory.
I'll press next.
Here you can choose the compiler,
it's probably already chosen it for you.
If you've got multiple compilers,
you can set individual compilers on a per-project level,
but we're using the MinGW compiler,
and we're using the GNU debugger.
The build system will be default, and select finish.
So it's gone off and created a new project,
you can see it here on the left side, it's called Test One.
And as I explode these,
you can see that there's my main CPP file.
That's the program that it's created for me by default.
The .CPP extension means that it's a C++ file.
I'm going to double click on that,
and you can see my font is pretty small here,
'cause I just installed this.
Let me increase my font.
You may not have to do this on your end,
but it's gonna show up better on video if I do it.
So I'm gonna go to settings, colors and fonts,
and I'll just set it to at 16, I think should be nice.
Apply, okay, there we go,
that way it's much easier for you to see.
Now what we want to do is we want to delete all this.
This is actually C code, not C++ code.
So let's delete all that
and let's write a real simple test from scratch.
So the first thing we'll do is we'll include iostream.
This allows us to do input and output.
And we will talk much more
about what these include directives mean in a future video.
In this example, just type along,
and make sure that the environment is working.
So you want to say pound include,
and iostream in angle brackets.
Then we want to say int, space, main,
this is our main function.
Two parens,
and we'll create a couple of curlies, curly braces.
Then in here all we're gonna say is std, colon colon c-out.
The insertion operator, which is two less than signs,
followed by "Hello testing" or anything you like.
And then a semicolon at the end,
and then finally return zero.
That's it. That's a simple test.
Again, there'll be a separate video
where I go over the anatomy of a C++ program
and we'll go over all this in detail.
So in this case, again, we're including iostream,
we've got our main function,
and we're printing "Hello testing" to the screen.
We're returning zero, which means program successful.
Okay, I'm going to save this.
And I'm not gonna do this on the videos,
but you can certainly do this at home.
If you come up to view, and you can toggle the minimal view.
When you do that, you'll get some icons up here,
and you can use these icons to build and save,
for example, that's the save right there.
I'm not gonna do that 'cause I want
as much screen real estate as possible on the videos.
So I'll just toggle that off.
Okay, so I'm going to file, save.
And at this point we're ready to run the program,
but we need to make a couple of changes
just because we want to use modern C++.
So what we can do is we can click on the project,
Test1 in this example, and I'll right click,
and down at the bottom you'll see settings.
So we'll select settings.
And you can see right down here at the bottom
where it says global settings, I wanna select that.
And where it says C++ compiler options,
you can click right in there,
and then you'll see these three little dots
here on the button, so it gives us another menu,
so you can select that.
And we wanna make sure that a couple of things are set.
We want to be sure that C++ 14 is checked.
That means we're using the latest version of the standard,
which is Modern C++.
We also wanna be sure that the WALL,
all warnings is checked.
Okay, so that's it, for now that'll be fine,
we'll select okay.
And we'll apply, and okay, perfect.
Now I also want to click on the workspace itself,
and right click on that.
And come down to workspace settings and select that.
And when you come to code completion,
you wanna be sure that C++ 14 Standard is enabled.
Code completion is something that the IDE does.
As you type, it's trying to figure out what you want to do
and help you out so you don't have to do a lot of typing.
And in this case, we want to tell it to use
the C++ 14 standard when it's trying to figure things out.
So I'll select okay.
Now at this point we should be ready to try this out.
So I'm gonna expand this little window
down here at the bottom,
and I'm gonna come up to where it says build,
and then we'll select clean project.
Then we'll go back to build, and just say run.
At this point it's gonna say, what do you want to do?
Do you just wanna run it or you wanna build it and run it?
In this case, I wanna build it and run it,
and I'll talk more about the workflow
that's used for cleaning and compiling and so forth
a little bit later on in the course.
So in this case, I wanna say build and execute,
and it will compile and run the program.
If there are no errors, it'll run,
you'll get a window pop up with the output,
"Hello testing" in there.
If there are errors,
let me show you what they might look like
just in case you do see them.
Suppose I forget that semicolon at the end there.
And I'm going to say build, run, build and execute.
And you can see this red down here that says,
"Error, expected a semicolon before the return."
You also get a red error here.
And it says again, semicolon expected.
So basically you just put the semicolon in there, save it,
and then go back up to build and run, build and execute,
you can click on here for it to remember
to always build and execute or just execute.
Again, don't do that yet.
We'll do that as the course progresses
and I'll show you the different workflows we can use.
So build and execute.
There we go.
Now, if at this point you get an error that says
that some DLL can't be found, then what you want to do is,
you want to go back to the project, right click,
and go down to settings.
And remember, you only have to do this
if you get some kind of runtime error that says
some CPP DLL file is not found.
And go to global settings.
And then what you wanna do is you want to go
to the linker options.
And just select right on there and click that little button.
And down here at the bottom,
what you wanna do is you just want add a couple of lines.
You could say dash, static, dash libGCC,
and then press enter,
and that dash static, dash libSTD, C++.
Okay, so what'll happen here is now the linker
is going to statically link the files,
and not have to use dynamically linked libraries or DLLs.
Again, you only have to do this if you get that error.
If you don't get the error, you can do it also,
and it's not gonna hurt, but I'll select okay, apply,
and let's do a build.
Rebuild, let's do a clean first,
whenever you change any kind of settings,
you want to clean the project,
which really just cleans everything up
and gives you a starting place.
So we'll clean the project, and then we'll just say run,
build and execute.
In this case, it's gonna statically link it,
which is just as good.
And hello testing. we're all set.
At this point we've got a good install, it's configured,
and we're ready to use CodeLite to start learning C++.