In this video, we're going to configure the code light ID that we just installed to work on our Windows
system with C++.
So the first thing we want to do is we want to start code light.
So I'm just going to double click on the icon.
And the first time that you run code light, you'll probably get a little setup wizard pop up and here
it is.
You may also get a window that says you want to update to the latest version, which you can certainly
do.
I'm going to 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 going to go through this and you only have to do this one time.
I'm going to select next.
Now here, the way that code light works is it uses a lot of plug ins 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 plug ins so you can see all the checkmarks are gone
and then we want to toggle the C++ plug ins only.
So I'm going to select that until only the C++ ones show up.
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 want to set up the compiler.
Now, remember, if you've already installed the GW compiler, then you can just click scan.
If you have it, go back to the video and install it.
I wouldn't install it from this option because it installs an older version of the GW compiler.
So I'm going to scan and it should find it.
There it is.
So I want to select it and press next.
Now here you can customize the colors to whatever you like.
This dark monarchy theme.
It's kind of nice on the on the vision.
It's not so hard on your eyes.
But 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 will leave these defaults
as is and we'll press finish now at this point you want to save an exit.
It's going to ask you this every time you make a change and it gets pretty annoying.
So I'm just going to say remember my answer and don't ask me again.
And every time I make a change, I want to save an exit.
So I'll save an exit.
So it saves it and it opens it up again.
And now these settings that I set were applied.
And again, I'll cancel the new download here.
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 want to create a new workspace and once we create the new workspace,
we'll run a couple of 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 want to do is create a new workspace.
I'll select that.
You can also say file new workspace, so I'll do it right here.
And it's going to ask me for the name of the workspace.
So I'll just say Keep workspace.
You could do this whatever you like.
If you want to have a workspace for all the section one exercises, section two, section three, or
whatever you like, whatever it makes sense for you, I'm going to put it in my documents folder and
I want to 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 of 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 Plus Plus.
That's basically the C++ compiler.
It's called G Plus Plus because it's from Janu.
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 test one, let's say.
And again I want to 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 GW compiler and we're using the new 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 DOT 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 because I just installed
this.
Let me increase my font.
You may not have to do this on your end, but it's going to show up better on video if I do it.
So I'm going to go to settings, colors and fonts and I'll just set it to 16 I think should be nice.
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 IO Stream.
This allows us to do input and output and we'll 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 IO stream and angle brackets.
Then we want to say int space main.
This is our main function to parens and we'll create a couple of curlies, curly braces.
Then in here, all we're going to say is STD, colon, colon.
See out the insertion operator, which is two less than sines 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 IO stream.
We've got our main function and we're printing hello testing to the screen.
We're returning zero, which means program successful.
I'm going to save this and I'm not going to 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 say, for
example, that's the save right there.
I'm not going to do that because I want as much screen real estate as possible on the videos.
So I'll just toggle that off.
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 test one 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 want to 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 want to 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 want to be sure that the W lx all warnings is checked.
So that's it for now.
That'll be fine.
We'll select OC
and will apply and OC.
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 want to 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 for the C++ 14 standard.
So 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 going to expand this little window down here at the bottom and I'm going to 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 going to say, What do you want to do?
Do you just want to run it?
Or You want to build it and run it?
In this case, I want to 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 want to say build and execute and it will compile and run the program.
If there are no errors, it'll run and 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
an execute.
You can click on here for it to remember, to always build an 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 CP DLL file is not found and go
to global settings.
And then what you want to 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 want to do is you just want to add a couple of lines.
You could say dash static, dash lib GCSE and then press enter and then dash static dash lib std c plus
plus.
So what will 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 if you get that error, if you don't get the error, you can
do it also and it's not going to hurt.
But I'll select OC 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 going to 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 code.
Like to start learning C++.