Welcome back.
In this video, we're going to configure code light to run on Mac OS ten.
Now I'm running Mac OS ten Catalina and I'm installing code Lite 14 .0.0 in this case.
Before we do this, we've got to be sure that the compiler and code light have been downloaded and installed.
I did that in the previous videos.
If you haven't done that, please go back and do that.
So again, I've installed the compiler and code light.
Now I'm going to run code light for the first time.
You can come up to spotlight search and type code light and you can see code light shows up right here,
version 14 .0.0.
And I'm going to double click that to run it.
Now, this is pretty normal.
You may or may not get this error message here.
This is very common when you're installing software from the Internet.
That's not coming from the Apple App Store.
It says that code light can't be opened because the developer cannot be verified.
So what does that mean?
That just means that you have to allow it to run.
Okay.
It's a security feature.
So what we're going to do is we're going to cancel here and and again, you may not get that message.
It all depends on how your system has been set up.
Come up to the apple and go to system preferences and then you're going to select security and privacy
right here.
Let me move this to the center here.
I'm going to select security and privacy.
And then in the first tab, the general tab, you can see right down here, it says code light was blocked
from use because it's not from an identified developer.
Again, all that means is that this app didn't come from the app store, it came from the Internet.
So I'm going to select Open anyway and that will run code light.
And again, now you can see I get the same message, but now I get the open button.
So I'm going to click the open button and let me close this system preferences.
And that's going to run code light for the first time.
And this is what you get the first time you run code light.
Now, there's a lot going on here.
I've got a workspace view over here.
I've got a welcome window and it looks like a wizard wants to run a setup wizard.
And I also have this message down here that says Code light now offers a better editor color theme.
So again, there's a lot going on.
You may or may not get this message down at the bottom about the color theme.
If you do, then what I'd like you to do is cancel the wizard.
We'll run it manually in a moment and say yes to this fix.
So I'm going to select yes right down here on the bottom right.
And I'm going to click yes.
And it says a code light restart is needed.
Would you like to restart it now?
I'm going to say yes again.
Now Code light will close down and restart and it should be back in a second.
Okay, perfect.
Now, what we need to do is we need to run the wizard, the setup wizard.
That's the one we canceled the second ago.
So let's run it manually.
We come up to help run the setup wizard.
Okay, I'll do that again.
I'm going to select help run the Setup Wizard.
Now, it's important that we do this.
We only have to do this one time right now.
That's it.
Once this is done, we don't have to do it again.
So welcome to the setup Wizard.
I'm going to select next What's my development profile?
In other words, what kind of development am I going to be doing with code light?
Well, I'm going to be doing C C plus plus development code Light supports PHP, JavaScript node.
I believe I'm just going to select C, C plus plus development because that's what this course is about
and select next.
Now, this is a really important step.
Remember, we've already installed our compilers, so we're going to let code light set up those compilers
for us.
So we're going to click on the scan and code light will scan our system for those compilers.
So I'm going to select that now.
And you can see that three compilers show up now that's pretty normal.
It's really the same compiler with three different names.
So this is exactly what we want.
If nothing comes up here, then it's very likely that you didn't install the compiler.
So go back to the previous videos and install your compiler.
I'll select next here you can customize your colors.
I'm just using the defaults here.
The dark, the light, the gray, whatever you prefer.
Again, I'm just selecting the default.
I'll select next for white space and indentation.
I'm just going to leave these defaults as they are and I'm going to select Finish now we're done code
that's going to close up and open up again and our compilers and our environment should be set up.
First thing, we need to verify that the compilers were indeed set up correctly.
So we can do that by coming up to settings, build settings, and then you can see right here under
the Compilers tab, when you select GCC, we're going to use GCC.
Now the important thing is that when you select GCC and compilers and then tools, you see stuff here,
we see those paths here.
If there's nothing here, then again, most likely something went wrong with your compiler installation.
Okay, so that's it.
I'm going to select.
Okay.
And our compiler is set up.
Okay.
So code Lite, as I mentioned, is an integrated development environment, which means that we can build
and run and debug RC programs.
It uses a workspace model.
So the idea is that we can create a workspace and we create workspaces.
On this left side here you can see workspace view up here and then we can add multiple projects to a
workspace.
Now that's pretty cool.
We can have one workspace and a whole bunch of projects within it.
A lot of other ides don't work that way.
They basically just allow you to work on one thing at a time.
So this is a pretty nice model here.
Now, in order to do that, we need to create a new workspace, right?
There's nothing here.
You can see there's a lot of space here, right?
There's nothing going on.
So what we're going to do is we're going to create a new workspace.
We can do that by clicking right here on this button, new workspace.
Or I can come up to appear in the menu bar and click Workspace New workspace.
Again, I could use either one.
I'm going to select this button right here and then I get this select workspace type dialog box.
I want to create a Cplusplus workspace.
It's really important that we choose Cplusplus here and I'll select.
Okay, now it's going to ask me, where do you want to store this workspace?
I'm just going to put it right in my user directories, documents, directory or documents folder and
what's my workspace name?
I'm just going to call it first workspace here.
It shows you the complete path to where this file first workspace workspace is going to be stored.
If you want to put it somewhere else, you can just click these three buttons and choose whatever folder
you like.
I would encourage you to select that little checkbox down here.
That way it creates the workspace in a separate directory.
That way, when we create multiple workspaces, they'll be nicely organized.
Now word of warning do not use spaces.
Special characters.
In other words, don't use spaces like this here.
Don't use special characters like pluses and ampersands and all kinds of weird things, and don't use
any international characters either.
Those will cause all kinds of build issues.
Keep the naming really, really straightforward with everything we do in code line.
Okay.
Also, if your user name, you can see my username right here is my first name and last name.
If your user name has spaces or if it has special characters or international characters, then put
your workspace somewhere else.
Create a new folder somewhere that doesn't have that and just store it somewhere else or off your directory.
We're good to go here.
We're going to create the workspace.
Now when I click okay, you're going to see this workspace first workspace appear right up here in the
Workspace View up in the top left.
So I'm going to click okay.
And here is my workspace.
You can see it right there.
First workspace, you can see this whole area here on the right has been cleared out in and of itself.
The workspace really doesn't do much for us.
It's really a container or a holder for projects.
So what we need to do now is to create our first project and we can do that by selecting the workspace
and then right clicking on it and selecting new new project.
Okay, So I'll do that again.
We're going to right click on the workspace and then select new new project.
And now we're going to get a new project Wizard.
And this is really important that we get this right.
There's a lot of settings here, and depending on how we fill them out, our projects may or may not
build.
So I'll go through this really slowly and carefully.
This is the path to our workspace and it's asking us for a new project name right here.
So I'm just going to call this project one again.
No spaces, no special characters, no international characters.
Make sure that this checkbox is checked.
Create the project in its own folder under that workspace that keeps them nicely organized.
The category we're going to select Console.
The next option here is the type for type.
We want to actually select simple executable GCC.
This is really important because we're going to be using the C compiler writing C programs, so we want
to use GCC for type the compiler, we want to make sure we select GCC again, C programs very important
for the debugger.
We want to select the Lldb debugger because we're on a mac.
We use a different debugger than the normal GDB.
And then for the build system we want to make sure we select default.
That's really, really important.
It's probably the most important step here for the build system.
So again, make sure you understand all these settings, make sure they look like this.
If you have to pause the video, make sure that they're all this again, I'll go through it again.
First workspace is the name Create the project in its own folder.
The category is console type is simple executable GCC compiler is GCC, the debugger is Lldb debugger
and the build system is default.
And just to emphasize to the name, it's really important not to have any spaces in the name, any special
characters.
That's really important because I often see a lot of questions in the Q and A about, Hey, my project
didn't work.
It's because you put in a special character here.
At this point, I'm going to go ahead and select.
Okay.
When I select.
Okay.
You'll notice that my project was created here right under my first workspace.
We have the first workspace project name.
We can actually select these arrows to actually see there's a source file folder underneath and then
there's a main.c.
Now, we don't actually see anything over here yet because we haven't selected Main.c, but if we double
click on Main.c, you'll see that the editor comes up and we see some C code in here.
Now the font is a little, little small, so I'm going to make it a little bit bigger.
You don't necessarily have to do this, but if we go ahead and we actually select.
We can go right to settings, colors and fonts and we can just change it to be a little bit larger.
We're going to go ahead and change this to 18.
Probably be a good size just so you guys can see it and just hit.
Okay.
And apply.
And we should also notice in this editor that whenever you don't have anything saved, you'll see the
red.
So if you actually try to edit this file, you put anything, you see the red there on the side, that
means the file is not saved.
Normally you could go up to file and you could say save file, but the save file is grayed out.
It's a bug in code light, so you can still do the command s So if you just hit your windows key or
command s, it will save it and you'll see it go to green and that's how you can add it.
So you can always see whether or not your file is up to date with the latest code changes that you've
made by hitting control S or Windows Key S to save.
If you're on a mac command S and that will save the file and it will go back to being green.
So I'm just going to go ahead and modify this just again, you can see the change from red to green
whenever you type in, once you save the actual file.
And so we're good.
Our code looks pretty good.
It's a simple C program.
Again, we'll explain all this code in later lectures, but at this point, we're almost ready to compile
into the program.
But first we have to modify the project settings so we can actually go to the first workspace right
here, highlight it on the left side and we can right click and we can actually go to the project settings
right at the bottom here.
I actually made a mistake there.
That should be Project one, not workspace one.
I named my project wrong, so make sure you select your project and then go to Settings Project.
We should be Project one minus Workspace one.
And here you'll see there's general compiler linker settings on the right.
The general settings are pretty much filled in for you.
You don't have to change anything here.
Everything is set from when we set the compiler and build settings earlier.
You do want to select the compiler option and you want to go down to the C compiler options.
You want to make sure you can see if you select that there will be a dot, dot, dot.
Once you select the dot, dot, dot, you can actually see some of the options.
We want to make sure basically we want to and you'll see that the options are added.
The command line.
We want to enable all warnings, all that's actually not checked.
That's a bug.
And then we also just want to make sure again, this is a C program.
We want to make sure we optimize for debugging.
We produce debugging information.
We should be good.
We might want to say enable C 99.
So we want to check that one too.
So again, there's only four checks here.
I think enable C 99.
We want to make sure the all for all warnings are shown.
We want to make sure that optimized for debugging is shown and that we produce debugging information
dash G and that's all down there.
So at this point we can just say, okay, followed by okay, again, again, a real simple application
here so we can actually build and compile this by going up to the build menu option and we can actually
say build and run project.
And you may ask yourself, you know, the settings we just applied, we're actually going to you don't
have to do those settings for every single project.
We're going to actually, in a couple videos, walk through a way to create a template for all your
projects so you don't have to pull all these settings, but we are going to build here.
So let's go ahead and go to build, build and run project.
And if there's no errors, I didn't make any typos.
We should see the project was built successfully and it's actually run.
So you see this little code latex shell come up some last login information.
But what you really see here that's important is the program that was run which just displayed output
called hello testing to the screen.
And so we were able to compile and run successfully.
So now we can just hit any key to close.
That's what you'll see here is there's a couple important tabs here at the bottom.
The first one is output, and the output tab down here really just shows you what the program did when
it ran.
So it tells you where it's running from and it tells you that it executed the shell command to the exact
shell command and that the program exited.
Sometimes this is important if you're running from a different directory and so forth.
The other tab that's really important is the build.
The build is really the tab that's really showing you the commands that were run to run and execute
the program.
So here you see the GCC command to compile it.
Dash C is the flag for compiling and then Dash G are some of the settings that we set earlier, right?
Dash G is producing debug information optimization using C 99 standard and so forth.
Then it's doing the linking and all stuff and then we actually run it.
We would run the debugger using G plus plus, but you'll see there's no errors and no warnings.
So we are successfully able to run that.
This screen is really important.
A lot of times you can copy paste the screen in the Q and A, and I can diagnose a problem if you have
this information.
So build an output are really important.
Now, if you were to build this program and you actually had a compile error.
So let's say we remove the semicolon and you'll see the red.
It turned red there because I haven't saved it.
So now if I save that, it will hit green.
But now when I go up to build and I say build and run, I'm actually going to have an error, right?
It's going to say and actually pops up with a little pop up box here.
Confirm build ended with errors continue.
And we're saying no because we weren't able to build.
And then you'll see in the build output tab here that there's a little red error that basically says
we're missing a semicolon.
You can actually select this and it will bring you up to an arrow up here telling you where the error
is.
So here you could actually add the semicolon to fix your problem and then save it again.
And then you could build and run it and you would build it successfully and it would run so you could
rebuild your project and you would see there's no errors and then you could run it as well after that.
So you notice the build, the run, all that can be in separate steps or it can be in the same step.
Now, other common errors that may be in here for your first C program, a lot of times you'll see forgetting
for forgetting a bracket may not have a bracket.
So you have to make sure your brackets line up.
Sometimes you forget a left or a right end.
It's very, very specific.
Compilers are very specific in syntax.
You you've got to pay attention to all the details, all the syntax.
You can actually have other issues if you misspell the header file, maybe stereo, things like that.
So you have to make sure everything's okay.
And then all we save once you're done making your changes and rebuild, to rebuild the compiler to get
rid of your errors.
One other thing I want to mention is you saw the previous terminal coming up earlier.
I don't really like that terminal that much.
There's a lot of information in it.
So you can actually change the terminal that gets shown when you run the program.
You can just go up to code light menu option, you can go to your preferences and then at the very bottom
you can go to terminal here.
And by default, it's just going to say terminal.
You can actually select the code light terminal.
I like this one a little bit better.
It has less information in it.
And there are some issues when you run the other terminal where a lot of terminal windows show up.
So I'm going to go ahead and select the code light terminal on the terminal option and say apply and
then hit.
Okay.
And now when I build and I run this.
You're going to see it comes up in a slightly different terminal.
And this little this purple bluish type terminal, you can then say, okay, so it can allow it.
And then it will run.
And you can see it says hello testing and you can continue this lesson information there.
It's a little bit nicer, I think.
So this is one option.
You can see if you want to change the terminal and then hit any key to exit that terminal window.
Okay.
So that about does it.
We were able to write our own code here, just a little program, build and run it.
We change the terminal.
If you have any errors at all in this program, it's really important that you take the build output
from the build tab here and you can kind of post that in the form if you had any issues and I can help
solve them.
But this is basically it, right?
Setting up your environment and code light so that you can run a C program using the C compiler and
everything.
You'll notice the code light restart is needed because I did change the terminal, but that's about
it.
If you have any questions, please post on the forum.
Thank you.