In this video, we'll take a look at the main elements
of the CodeLite IDE or integrated development environment.
Now integrated development environments are really nice because they allow you to
build and compile and edit and debug
and do everything from a comment interface,
but they can be pretty complicated as well.
Now the CodeLite IDE is a fairly simple IDE as far as IDEs go.
If you use Microsoft visual studio or if you use XCode and Eclipse and others,
they're much more complicated, and they've got a lot more bells and whistles.
But CodeLite's a great IDE for c++, especially when we're learning.
So let me go over some of the main elements here.
When you first start CodeLite,
you have an interface that looks like this.
This is the main default interface
or perspective as it's called in CodeLite.
Over here on the left, you have the workspace pane,
which is this little rectangular area right here.
Here in this large area we've got our editing pane.
This is where we're going to be editing and typing our source code.
Then we've got an output pane down at the bottom. And you can see that each one of these has
a lot of little tabs in there, and I'll break that up. So you can see it a little better.
So here we've got a workspace tab, an explorer tab and so forth.
And I'll go over what those do in just a moment.
Now at the moment, there is no workspace at all.
So we need to create a workspace.
And then we need to add projects to that workspace.
So let's do that. Let's create a new workspace, and we can do it right here.
We can select new workspace right on the main menu here
or we could go up to a workspace, new workspace or we could go to file,
new, new workspace.
You can choose whichever one you like. I'll choose this one right here.
And I'll give the workspace a name.
In this case, I'm going to call it Section 4 because this is
a video in section 4 and that way we can create all our section for projects
right within this workspace.
The path for the workspace you need to provide,
I'm going to select my cpp
examples folder, which is on my desktop.
I'll select that.
And this will create that workspace within that folder, and I'll select okay.
Now you can see that we've got a workspace here called Section 4.
And a couple of other things have popped up here. You can see there's a debug drop down,
and we'll get to all that in just a bit.
So at this point, we need to create some projects.
Notice that there is nothing to edit here in this window.
It's empty because there are no c++ files ready for editing yet.
So let's create a project.
This is going to be very similar to the way we created the projects in the installation videos
in the previous sections. So I'm going to right click on section 4 workspace,
and I'm going to say new project.
At this point, I'm going to select that default project template that we created.
In this case, I called it Frank default g++ project. So I'm going to select that
press next.
And I'm going to give this project a name. I'm just simply going to call it project1.
I'll select next. I'll accept these defaults, which is my compiler and debugger.
And I'll select finish.
So now you can see I've got a project named project1
under my section 4 workspace,
and you can see there's the main cpp file.
If I double click that, it will open up in the editor.
And it's just going to say hello world.
We'll get to building and running this in the next video.
But for now, let's create another project
because remember, we can have multiple projects in our workspace.
So I'm going to go back up to my workspace, right click,
do again new project.
I'll use the same template, and I'll just call this project2
and press next and finish.
Okay. So now you can see that we've got two projects within the workspace.
Also notice that project1 is italicized and it's bold.
This tells you that this is the current project or the active project.
Now I can select the main cpp in project two,
and you can see here we've got two c++ files.
One for each project. Now you'll notice that when I select these tabs,
you'll notice I select this tab and this highlights right here,
so this tells you that this is the main cpp for project1.
When I select this tab here on the right,
this main cpp lights up for project2.
If you're not getting that behavior,
then this little link right here is probably not selected.
If that's unselected, then you'll click on these and this won't change at all on the left side here,
in the workspace view.
So you want to make sure that that's selected. That way it links the editor to the workspace file.
So there we go. We can switch between them very easily.
So let's change this source code.
I'm going to select this file right here, and I'm just going to say Hello Project1.
And I'm going to save it with ctrl s or command s.
And I'm going to select this guy right here, and I'm going to say hello project2.
That way we'll be able to see the difference when we run them.
And again, I'm saving it. We could also do file save.
That's it.
Now suppose I want to change between projects.
So here notice that project one is the active project.
You can select the active project just by choosing it here from the download list.
You can see when I when I hover over it it says select the active project.
So that's as simple as that. You can also double click on the project name.
So if I double click on project2, project2 is now the active project.
Project1 is now the active project.
Now what does active project mean? Well, when I build a project,
let's say I come up to my build and I say build something, run something,
clean something, and I'll get to all this in the next video,
it's going to apply it to the currently active project.
It's real important because suppose that now you're here
and you're modifying this source code here. And then you build
and you see nothing's changed. Well, that's because this project2 is not active.
Project1 is the active project.
So when you build and run, it's going to run project1.
It may seem like this is pretty hard to keep track of, but it's really not.
It's really easy to keep track of what project is active.
And using this little link editor, you can obviously see which file you're working on.
So it's pretty easy to do.
There's a couple of other things that I wanted to talk about here.In the editor window here,
you can see that we've got line numbers selected.
Okay. So that the IDE is displaying line numbers for us.
This is handy because the compiler errors will give you line numbers
and it'll also throw you a little error right here it'll show you some red
a little mark that says hey the error is here, which is kind of nice.
I'm going to keep the line numbers on for me.
You can choose to not use them if it distracts you.
But in the course, I'll refer to line number 7,
line number 5. That way it's much easier for you to follow along.
If you want to get rid of those line numbers,
you could just go up to settings, preferences
and right under editor, you could see show line numbers in the margin and you could just uncheck that.
It's a whole bunch of other options.
The other thing you might notice is
you'll notice right here to the left of the end there's a little triangle.
That's called a code folding triangle.
So if I select that
you can see what happens is notice I've got active right now lines 3, 4.
Well, I've got all my lines, right, from 1 to 8.
But when I select that, it hides lines 4, 5 and 6.
And you get this horizontal line, showing you that yeah there is stuff in here.
I'm just hiding it right now. This is called code folding.
It basically just hides that code.
This is real handy when you've got hundreds
and hundreds of lines of code in your file,
and you're scrolling through trying to find things.
It's really really nice to be able to just fold some stuff up.
In other words, I'm working on this function right now I don't need to see all the other ones.
I just fold them out of the way.
We'll get to use these features later on as our programs get bigger. But
if you find yourself in the position where you've clicked on that by accident,
you see this line and you're thinking oh my goodness where did my source code go,
don't worry the source code is still there.
Again, if you see that horizontal line, just
click on that little triangle and it will show it for you.
Also notice that the editor uses color coding
to display certain things. So for example you can see that int
and return are a purple color.
And you can also see that hello project2 here is in this dark blue color.
We've also got things in dark green, light green and so forth,
also notice that the integer 0 is red.
So there's rules that the IDE is using behind the scenes
to make it easier for you to figure out what's going on.
So one of the rules is it's saying hey
you know what if you're seeing a reserve word or one of the keywords in c++
make them purple.
You can tweak all of these by going to settings, colors and fonts,
select c++ here on the left
and you can customize the font that youwant to use for
your keywords and so forth.
I recommend you just leave this alone unless you have a real problem with some of the colors that are there.
Okay. So that makes it really easy to
figure out what's going on. So for example, let's say I forgot this
quote right here.
You can see that that entire thing is now a dark blue.
That tells you something's not right. So we can always use that coloring
to help us out. It's the IDE trying to make life easier for you.
The output pane down at the bottom,
this is where our compiler messages will be displayed when we build code.
You know, it'll tell us what we're building, the status of the build and so forth.
It'll also be handy for for doing global search and replaces,
both at the workspace level and at the project level.
I mean sometimes you want to change a name from hello to hello there.
And it's really easy to do a global search and replace.
There's a bunch of other tabs here.
These tabs we're not going to use most of them.
I'm basically just going to leave them alone.
But if they bother you, you want to get rid of them,
you can click on these three horizontal dots right here.
These three vertical dots rather right here.
And you can select to hide certain things. So let's say we don't want to see
the BuildQ tab.
Just select BuildQ and it hides it. You can always bring it back if you like.
Like I said, I'm just going to leave them alone.
But if you're if your screen real estate is small
or your monitor is small and you're having trouble you know fitting all this stuff in,
this is a really easy way to do it.
The ones we're going to use the most are Build
and Output and obviously Search and Replace can come in very handy.
Okay. Now in the workspace view, we've also got some tabs.
Now here, I'm going to spread this so you can see it a little bit.
The only ones we're really going to use here are workspace,
explorer and tabs. These last three tab groups, cmakehelp and wxcrafter,
we're not really going to use them so what we can do is we can hide those.
So again, I'll select the three dots,
and I'll hide wxcrafter, I'll hide cmake,
and I'll hide tab groups.
That's it. That makes it a little less cluttered. And it's kind of nice to
see it all there.
This little drop down arrow here.
If I'm in tabs and I select download I can go to workspace.
If you only have three tabs, that's not really a big deal.
But if you've got a lot of tabs then it's real nice to be able to
do that, especially when when they're hidden and you can't see them in a
situation like this.
So the last thing I want to do is I want to show you that you can actually move
these panes around.
Now this is the default perspective that you get out of the can.
Some people don't like the workspace view on the left, they prefer it on the right.
So you could just grab the workspace view tab right here
and, just move it over, drag it to the right and you'll see it light up.
You can see here if I wanted to put it down here, it lights up.
The area that it's going to be in lights up
again at the top. You can choose to put it wherever you like.
Let's say youlike it over here on the right.
And some people like this workflow a little better.
So now you've got your workspace here on the right and your editor on the left.
You can do the same thing with this output view.
I mean suppose I want to put my output view right under
my workspace view, I could do that. Now I've got a really large editing area.
It's totally up to you,
the perspective that you use. This is a really personal decision.
I've worked on teams where everybody on the team -- teams of hundreds.
Everybody's got their own way of doing things. So everybody tweaks the environment their way.
The nice thing about this is that if
you download some project and it's got this
perspective saved, you can always come up to perspective
and click on default layout and that'll bring it right back to the default.
So I can just select that and here I am back just back to scratch
just like you came out of the can.
If you prefer your layout to be a specific way, let's say, I like it like this and
I want to move this over just a little bit here.
And this guy's up here like that.
Again, however you want to do it, you can come up to perspective
and then save current layout as.
So let's just say I want to call this Frank.layout.
And I can save it.
So I can switch between the default layout.
And if I want to go back to my own layout, I can go back to Frank layout.
Really, really easy to do. There's two layouts that come
already pre-configured.
One is the default layout which is the one I've shown you before.
And the other one is the debug layout. This is the layout that's used when you're doing debugging.
So if I select debug layout,
you can see that I've got an output view pane on the left and a debugger pane on the right.
And CodeLite will switch to this automatically when you go into debug mode.
Again, if you have a better way of doing it that works for you,
you can tweak this and save that perspective.
So I'll switch back to the default perspective.
And we can also use the view options
to hide or view
different panes. So for example if I don't want to see the output pane or the workspace pane,
I can certainly hide them and view them.
I can also do that here by closing up
with that little x right there to close up the workspace view.
I can also make the workspace view really large by clicking this icon right here.
So you've got all these options. And I encourage you to play around with the environment
and set it up to a place where you feel comfortable working.
Recall, we talked about this in one of the installation videos
that we can show a toolbar.
So we can build and run and save and have all kinds of options
by just clicking on these toolbar icons.
I'm not going to use that since it really clutters things up for me.
And I want to be able to explain exactly what I'm doing.
So for example that icon right there says run active project.
That one says start or continue debugger.
So they can be confusing at first. I'm not going to use those. I'm simply going to come up here and
tell you exactly what I'm doing.
So I'm going to close the toolbar down but again feel free to use it.
And that wraps up this quick tour of the CodeLite IDE.
We are certainly going to use more features as the course progresses.
In the next video, we'll create our first c++ program
that goes a little bit beyond the hello world program.
And we'll use that program to understand how the build process works within
the CodeLite IDE.