1
00:00:00,910 --> 00:00:02,860
Hello and welcome to a new lesson.

2
00:00:03,130 --> 00:00:08,260
Today, we're going to talk about how to compile your C++ program on a Mac.

3
00:00:08,770 --> 00:00:14,950
So the first thing that you want to do is go up to the search bar type terminal and press the enter

4
00:00:14,950 --> 00:00:15,370
key.

5
00:00:16,030 --> 00:00:22,010
So one thing that you should know is that the terminal is a Unix based terminal.

6
00:00:22,030 --> 00:00:23,530
Very similar to Bash.

7
00:00:24,530 --> 00:00:32,000
So the thing that I want to do is navigate to my desktop folder because this is where I want to create

8
00:00:32,000 --> 00:00:33,740
my C++ program.

9
00:00:34,430 --> 00:00:44,060
But before that, I will create a new directory called Hello World, where I'm going to actually have

10
00:00:44,150 --> 00:00:46,700
my C++ file.

11
00:00:47,360 --> 00:00:53,510
So now I've created that I will navigate to it.

12
00:00:53,810 --> 00:01:02,930
So now I can see I'm inside of my folder and I'm going to type then.

13
00:01:03,890 --> 00:01:09,870
And then the name of my file, which will be Hello, World Dot CBP.

14
00:01:10,490 --> 00:01:15,980
So then is a text editor commonly used for typing code.

15
00:01:16,760 --> 00:01:23,000
And as you can see, it has created and opened my C++ file.

16
00:01:23,970 --> 00:01:24,660
So.

17
00:01:25,690 --> 00:01:32,350
Now that this is open, I can't just start typing code inside of this file.

18
00:01:32,530 --> 00:01:40,720
I actually have to press on I to go into insert mode and this is where you type code.

19
00:01:42,550 --> 00:01:45,850
If you press escape, you go back to command mode.

20
00:01:46,600 --> 00:01:49,330
Command mode is used for navigating.

21
00:01:49,360 --> 00:01:56,050
Also, it protects your file to not be overridden by mistake or you don't want to like type something

22
00:01:56,050 --> 00:01:57,880
and it appears in your file.

23
00:01:58,090 --> 00:01:59,080
So it's nice.

24
00:02:01,060 --> 00:02:02,110
I'm an insert mode.

25
00:02:02,110 --> 00:02:05,320
I'm just going to type up my program real fast.

26
00:02:46,880 --> 00:02:54,170
So now that I have my program all typed up, I will press escape to bring me back to command mode,

27
00:02:54,800 --> 00:03:06,170
and the cool thing about them is that you can use certain keys to navigate around, for example K if

28
00:03:06,170 --> 00:03:07,160
you want to go up.

29
00:03:08,510 --> 00:03:14,450
J, if you want to go down, h if you want to go left and out, if you want to go right.

30
00:03:14,960 --> 00:03:23,780
So now if I go to the end of a line, you can see that I am still basically in between.

31
00:03:23,780 --> 00:03:27,200
If I click on I from Insert and I started typing.

32
00:03:27,740 --> 00:03:32,360
This is basically one character before the end of the line.

33
00:03:32,690 --> 00:03:41,990
So what you want to do is type A and this will bring you to the absolute end of the line.

34
00:03:42,260 --> 00:03:48,290
And now you can create a new line or just maybe type up a comment.

35
00:03:49,550 --> 00:03:51,950
So I just wanted to show you that cool feature.

36
00:03:53,360 --> 00:03:58,700
And now we want to save and exit.

37
00:03:58,700 --> 00:04:02,750
In order to do this, I need to be in this game to be in command mode.

38
00:04:02,750 --> 00:04:08,870
So I press escape and now I'm going to type colon.

39
00:04:10,350 --> 00:04:13,080
Double you from right.

40
00:04:13,350 --> 00:04:16,890
Cue from quit and exclamation mark.

41
00:04:17,520 --> 00:04:21,740
And this is the command that you want to type.

42
00:04:22,050 --> 00:04:26,580
And click Enter to actually save and quit.

43
00:04:27,600 --> 00:04:35,450
The other one that you can do is call an ex that does the exact same thing.

44
00:04:35,520 --> 00:04:38,880
This is actually what I use because I don't want to be typing too much.

45
00:04:39,330 --> 00:04:41,580
But now I click Enter.

46
00:04:42,540 --> 00:04:51,780
And if I type list from list, I can see that inside of my folder, where I am in the terminal, I have

47
00:04:51,810 --> 00:04:55,140
one file Hello World Dot Sweep.

48
00:04:56,250 --> 00:05:01,590
The next thing that I need to do is.

49
00:05:03,740 --> 00:05:12,410
Compile it, so for this, I'm going to type G Plus Plus space and then the name of the file, which

50
00:05:12,410 --> 00:05:20,870
is Hello World Cup and I click Enter now and has been compiled.

51
00:05:22,490 --> 00:05:31,130
And as you can see, Agar out is the executable that was created by the compiler.

52
00:05:32,480 --> 00:05:42,770
So one thing that I do want to mention is if you don't have C++ in for me, this is already installed.

53
00:05:43,070 --> 00:05:52,160
The computer will ask you if you want to install it, so you have the option when you try this to install

54
00:05:52,160 --> 00:05:55,730
it on the spot as it will suggest it to you.

55
00:05:56,000 --> 00:06:00,050
So now the next step that we're going to do is.

56
00:06:02,300 --> 00:06:14,450
Type dog slash aid, not out and click enter, and this is going to run my executable, as you can see.

57
00:06:14,720 --> 00:06:21,200
Hello World appears on my screen because that is what my program is doing.

58
00:06:22,300 --> 00:06:27,520
Now, another cool thing that I want.

59
00:06:28,560 --> 00:06:31,530
To show you is.

60
00:06:34,750 --> 00:06:39,130
This Web site, Vim Hyphen Adventures, dot com.

61
00:06:39,640 --> 00:06:46,750
So this is a game that you can play that actually helps you get better at them and it teaches you some

62
00:06:46,750 --> 00:06:47,830
of the commands.

63
00:06:48,280 --> 00:06:55,270
So I think this is very useful and I would also like to show you, Vinda, or this is where you can

64
00:06:55,270 --> 00:06:58,930
find all the documentation for them if you have.

65
00:07:01,690 --> 00:07:10,210
Any questions or you want to look deeper into what them can do so for us today?

66
00:07:10,240 --> 00:07:11,050
That was it.

67
00:07:11,050 --> 00:07:11,530
So.

68
00:07:12,070 --> 00:07:15,130
Thank you so much for watching and I hope to see you soon.
