Hello everyone.
In this video, we're going to configure CodeLite
to work with the compiler that we've already installed.
So, at this point, we've installed the compiler and we've installed CodeLite.
The first time you run CodeLite, you're going to get a welcome message like this.
And this is basically a setup wizard.
If you don't get this the first time you run CodeLite, you could just come up to help
and select run the Setup Wizard right there, okay?
But I did get the Setup wizard.
Also, you might get the Light mode or you may get the Dark mode,
it really depends on how you've got your Mac set up.
So, what we want to do is We do want to run this setup wizard.
So once it comes up, we want to click Next.
We want to select C, C++ development,
select next again.
And now, we're going to ask CodeLite to scan our system for installed compilers,
since we've already installed a compiler, it should find one, so I'll select Scan.
And you can see it found a bunch of stuff,
the most important one is the GCC, that's the one we're going to use.
If you see a GCC there, you're good to go.
So, I'm going to select Next.
Then what theme do I want to use?
You can use a Light theme or a Dark theme.
I'm just going to stick to the Dark theme because the Light theme,
although it comes off better on video,
is giving me some really weird glitchy
stuff with the recording that just doesn't look good.
So, I'm going to select next.
Don't make any changes here and click Finish.
Now CodeLite is going to stop and restart.
And once you're opened up, we're good to go.
Now down here, you can see where it says Local Workspaces,
there aren't any yet.
Once we start creating workspaces, they will show up here
and you can easily go back to previously used workspaces by just clicking on them.
The idea here is, we want to create
a workspace and then within that workspace, we want to create projects.
Each project would be a working C++ program.
So the first step is to create a workspace.
Now there's several ways to do it.
You can see the workspace view over here.
We can select new, create workspace, this big button right here,
we can go to Workspace, New Workspace, and I believe we can go to file
New Workspace as well.
So there's a lot of places we could do it.
I'm just going to click this big button right here.
Now, what is the workspace type?
Well, we're going to stick to C++, that's what we'll be using.
So I'm going to select C++ and click OK.
Now, it's going to ask me where I want to store these workspaces
and what I want to name them?
So you've got some choices here, you can put them in your documents,
you can put them on your desktop.
I'm going to create a path right off of my home directory
and I'm going to call it Workspaces.
And then I'm going to create as many workspaces as I want within that
area, that way I'm nicely organized.
So I'm just going to click this button over here with the three dots.
And right here, I'm going to create a new folder
and I'm going to call it Work Spaces, let me make that a capital W,
Workspaces.
That's it, I'll create it and I'll select it
and you can see now that the workspace path is going to be my home folder,
Workspaces.
And the workspace name for the workspace that I'm going to create
now is going to be called Workspace One.
That can be anything, that could be section five, that could be
pointers, if you're working on pointers, anything that makes sense for you.
Make sure that create the Workspace under a separate directory is checked
and click OK.
Now, you can see over here in the workspace view,
you have a workspace created called Workspace One.
Now that's not real useful until we create projects and that's the next step.
Let's create some projects within it, so we'll start with creating one project.
So I'm going to right click on there and select New Project.
Again, you can go up to file New Project.
A lot of different ways to do it, but let's just right click on the workspace
and create a new project.
Okay, so now we've got our new project wizard.
You can see that this project is going to go into Workspace One,
which is the workspace we have open.
And what do you want to name your project?
You can name it anything you want, I'm going to name it Project One.
Now, something that's really important throughout.
Do not use any spaces anywhere, do not use any
special characters like pluses and dots and
dollar signs and all kinds of weird things
and do not use any international characters.
So just keep it really plain, simple, no spaces,
no international characters, no special characters.
Once we do that, we want to check on Create the project in own folder.
Then what category console,
we're going to run these programs in a terminal window.
The type is going to be simple executable G++.
So again, simple executable G++.
The compiler we're going to use is the GCC compiler,
you may have other choices here, but just select GCC.
The debugger is going to be the lldb-vs code debugger,
that's the one on Mac.
And the build system is CodeLite make file generator.
And again, you've got some choices here, two choices, we're going to use that one.
In version 17.3, which is the version that I'm running now of CodeLite.
The developer removed the default build system.
Unfortunately, that makes it a little tougher for us to configure this.
The default build system worked great, I really don't know why he removed it,
but he did.
So, we'll deal with it.
At this point, we're going to click OK
and you can see in the workspace project One has been created.
There is a source folder for our source code
and there is our main.cpp file.
So if I double click on that you can see the source code right there
and I'm going to make this a little bit bigger, so I'm going to go over to my settings,
colors and fonts
and I'm going to set the font to
something around 20 or so, you guys can see 24.
So I'll click okay
and then I'll click Apply and then okay,
there we go.
So that font's a little bit easier to see now on video.
So, what are we going to do? We're going to remove all this
and we're going to write a real simple program.
Now notice that when I did that, this little red dot showed up.
What that means is?
That whatever is in here, in my editor has not been saved.
So this is a good clue for you to make sure you save everything.
So let's write the program and then we'll worry about saving it.
At this point, just type along and follow along,
the point of this video is to make sure that our development environment is set up,
it's not about learning C++ yet, we'll have plenty of time to do that,
all this will be explained.
So pound include,
we have a left angle bracket or left hand sign, io stream
and the right angle bracket.
And we're going to say using namespace,
space std with a semicolon at the end.
Make sure you have spaces between using namespace and std.
Now, we're going to write the main function, so we're going to type int, int space, main,
left paran, right paran and then a left curly brace.
Then in here we're just going to say cout,
two left angle brackets
side by side, no spaces between them
and I'm going to say, Hello World, that's what I'm going to display.
Make sure that Hello World is within double quotes, the whole thing.
Then we have two left angle brackets and endl for an end line.
Make sure that that's endl and not end1.
And then, we're going to return zero
with a semicolon at the end, make sure there's a space between the return and the zero.
That's it.
Now you can see that that red dot is there,
so I'm going to save this and I'm going to press Command S,
you can also come up to file,
save file but I'm just going to press command S
and that little red dot is gone.
Before we build this, we need to configure our
compiler to work with this project the way we want.
The way we can do that is,
you'll notice that Project One right there is bold and italicized
that tells CodeLite and us
that this project is the active project.
Remember, we could have many projects in here.
The active project is the one that's going to be built and run.
So it's really important that we select the one we want.
In this case, there's only one, so it's pretty easy.
So, I want to select the project and then, I'm going to come up here and click that wrench icon.
I can also right click on the project and come down here to settings,
same thing.
So, I'm just going to click that wrench icon.
And we get our project settings now.
Most of this we're not going to mess with, we're just going to leave it alone.
Most of this has been set up for us already, there's
one thing that we definitely have to do is this working directory right here,
I'm going to come over here, and I'm going to delete what's in there
and I'm just going to type dollar,
left paren and the word project path
with no spaces
and both P's are uppercase then I'm going to press tab.
So dollar, left peren, project path
right peren and the two P's and project path uppercase.
That's it.
Now, we'll go over to the compiler,
select it on the left
and right where it says C++ compiler options,
I'm just going to click on there
and this little button with three dots shows up, I want to click that
and I'm going to come over here and I'm going to select enable C++
17 features right there.
That's going to use the C++ 17 version of the C++ compiler.
I'll select OK.
At this point, we're done, I'll select OK.
And now, I'm going to come over here and build this project.
I'm going to come up here and I'm going to select build
and rebuild the project.
When I do that, an output pane comes up down here
and you get the build.
Notice that the C++ 17 shows up over here and so forth.
So this is a good build, it says build completed successfully, no errors, no warnings.
Our program has been built, so now we have an executable that we can run.
When we run that executable we expect it to say Hello World, right?
And that's what we wrote.
Great.
So, I'm going to close this
and I'm going to come up to build and now I'm going to run.
Do we want to build it again and execute?
No, I've already built it, I just want to execute it.
And we get a terminal up here and you notice it says Hello World right there,
right there.
So, we've got a good build, we've got a good run.
And then it says hit any key to continue, you can hit the key
and get used to closing this window like that by clicking on that little
red dot up there.
So that's it, we've got a program, it's running, it's pretty easy to do.
We can create another project, so why don't we do that?
Let's do that I'm going to click the workspace again, right click,
new, new project.
I'm going to put it in the same workspace but I want to call this one Project Two.
Again, you can name these anything you want.
Just be sure that there are no spaces, no international characters
and no special characters.
I know I say that a lot, but there's so many support questions
and when things don't work it's almost always
there's a dollar sign somewhere, there's a dot somewhere, there's a percent sign somewhere,
there's a space somewhere, so be sure you don't have any of that.
So again, make sure, create the project in its own folder.
We've got console, simple executable G++,
GCC, lldb-vs,
CodeLite make file generator, so it remembered the previous settings,
I'll select OK.
We'll go over to the project and we'll select the wrench.
We'll come over here to general and in the working directory,
we'll delete what's there.
And we'll replace it with dollar, open paren
project path, close the paren, just like that.
Then we'll come over to compiler,
we'll select the compiler options, the C++ compiler options right there,
click that little button,
select enable C++ 17 features, select OK,
apply these settings and hit OK and we're done.
Now, we can write our code for the Project Two.
So in this case, you'll notice, this is the code for Project One and you can tell up here
where it says Project One.
If we select this code, now Project Two opens up
and that's the main CPP file.
So, what I'd like to do is?
I want to really use this code here.
So I'm going to just copy it,
I'm doing command A and then command C to copy.
I'm just going to come in here and paste it with command V.
So I'm just going to say Hello World from Project Two.
That's it.
I'm going to save because it was unsaved before,
if I build now it's going to build Project One because you can see Project
One right here is italicized.
Project One is the active project.
So, we can make Project Two the active project by right clicking and saying
make active or we could also just double click on it.
Now, you can see Project Two is italicized and bold and it's good to go.
So now, I can build
and I can build my project or rebuild my project,
I'll go into more the differences between those in the class.
We have a clean build,
I come up to build and run, execute
and at this point, we should see Hello from Project Two, that's exactly what we see.
And you can make this window bigger by just hitting Command plus if you like,
you can see a little bit better.
Hit net to continue, we're done and we'll close this window up.
That's it.
We're pretty much done with this.
A couple of videos down,
refer to the video that shows us how to make a default project template
because that'll save us some time from having to do all this
stuff over and over and over again.
What we can do is?
We can create a default project template
and then create new projects from it
and all our settings will be there already.
So the last thing I'd like you to do is to come up to CodeLite
preferences and go over here to miscellaneous
and there's a setting right here, check for new version on startup uncheck that.
My advice would be once you have a working CodeLite
setup and compiler set up, don't mess with it, use it throughout the course.
Many times, as developers
we want, oh, I want the latest and greatest, that's usually a really bad idea.
The latest and greatest is usually on the bleeding edge,
it's buggy and there's all kinds of issues,
so once you have a working development environment,
leave it alone, don't mess with it.
So, just uncheck that and this thing won't keep
prompting you and pestering you to update till the latest and greatest, which
may not be.
So I'm going to apply, click OK.
And at that point, we're done, we're almost ready to start coding.
Refer to the section about creating the default template
and I'll see you in the next video.