VS Code doesn't compile on Mac

I’m on section 15, trying to create the main function, but everything after 4:17 does not work. I get an alert to install zsh, although I already have zsh as the default. It also does not show the directory of the file. When I type in the compling command as directed, nothing happens at all.

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

The link does not work.

When I try to compile, I get this:

haolejon@Jonathans-MBP C++ Unreal Engine % g++ triplex.cpp -o triplex
haolejon@Jonathans-MBP C++ Unreal Engine %

I am not sure what is wrong.

That’s the expected output. If you have “triplex” in the directory (no file extension) then you successfully compiled.

With the #iostream included and std:cout <<“Hello, world!”:, isn’t it supposed to output the string to the terminal?

No.

g++ triplex.cpp -o triplex

This compiles the file triplex.cpp and outputs an executable called triplex (what the -o is for).
In other words this creates the program, it doesn’t execute it.

./triplex

Is what would execute it.

1 Like

Okay, ./triplex was getting me nothing as well, even with autosave on and manually saving.

I closed the program down and re-opened it, and now it appears to be working.

On a related note, is there any issue using Xcode for this course? I am only going to be able to do the C++ portion of this course for now, my iMac is too old to upgrade to Catalina, and my MacBook does not have enough storage for Unreal games (I could probably get one game built on here). Or is learning C++ through terminal access a better way to go in the long run, proficiency-wise. Do employers expect you to use terminal for C++ programming?

It was only done as an exercise to show what an IDE would be doing for you behind the scenes. Most people will be using an IDE so feel free to use Xcode or any other IDE if you prefer.

Awesome, thanks!

Jonathan