Hello and welcome to a new lesson.
Today, we're going to talk about how to compile your C++ program on a Mac.
So the first thing that you want to do is go up to the search bar type terminal and press the enter
key.
So one thing that you should know is that the terminal is a Unix based terminal.
Very similar to Bash.
So the thing that I want to do is navigate to my desktop folder because this is where I want to create
my C++ program.
But before that, I will create a new directory called Hello World, where I'm going to actually have
my C++ file.
So now I've created that I will navigate to it.
So now I can see I'm inside of my folder and I'm going to type then.
And then the name of my file, which will be Hello, World Dot CBP.
So then is a text editor commonly used for typing code.
And as you can see, it has created and opened my C++ file.
So.
Now that this is open, I can't just start typing code inside of this file.
I actually have to press on I to go into insert mode and this is where you type code.
If you press escape, you go back to command mode.
Command mode is used for navigating.
Also, it protects your file to not be overridden by mistake or you don't want to like type something
and it appears in your file.
So it's nice.
I'm an insert mode.
I'm just going to type up my program real fast.
So now that I have my program all typed up, I will press escape to bring me back to command mode,
and the cool thing about them is that you can use certain keys to navigate around, for example K if
you want to go up.
J, if you want to go down, h if you want to go left and out, if you want to go right.
So now if I go to the end of a line, you can see that I am still basically in between.
If I click on I from Insert and I started typing.
This is basically one character before the end of the line.
So what you want to do is type A and this will bring you to the absolute end of the line.
And now you can create a new line or just maybe type up a comment.
So I just wanted to show you that cool feature.
And now we want to save and exit.
In order to do this, I need to be in this game to be in command mode.
So I press escape and now I'm going to type colon.
Double you from right.
Cue from quit and exclamation mark.
And this is the command that you want to type.
And click Enter to actually save and quit.
The other one that you can do is call an ex that does the exact same thing.
This is actually what I use because I don't want to be typing too much.
But now I click Enter.
And if I type list from list, I can see that inside of my folder, where I am in the terminal, I have
one file Hello World Dot Sweep.
The next thing that I need to do is.
Compile it, so for this, I'm going to type G Plus Plus space and then the name of the file, which
is Hello World Cup and I click Enter now and has been compiled.
And as you can see, Agar out is the executable that was created by the compiler.
So one thing that I do want to mention is if you don't have C++ in for me, this is already installed.
The computer will ask you if you want to install it, so you have the option when you try this to install
it on the spot as it will suggest it to you.
So now the next step that we're going to do is.
Type dog slash aid, not out and click enter, and this is going to run my executable, as you can see.
Hello World appears on my screen because that is what my program is doing.
Now, another cool thing that I want.
To show you is.
This Web site, Vim Hyphen Adventures, dot com.
So this is a game that you can play that actually helps you get better at them and it teaches you some
of the commands.
So I think this is very useful and I would also like to show you, Vinda, or this is where you can
find all the documentation for them if you have.
Any questions or you want to look deeper into what them can do so for us today?
That was it.
So.
Thank you so much for watching and I hope to see you soon.