Error in syntax when trying to compile triplex.cpp in the terminal

Hello

I’m right at the beginning of the course, starting to learn about C++ and when I try to compile the main() function it gives me these errors:

TripleX % g++ triplex.cpp -0 triplex

clang: error: unknown argument: ‘-0’

clang: error: no such file or directory: ‘triplex’

I’m not sure what to do.

It should be lowercase o, it’s short for output.

Hi @DanM

Thanks for the reply. I’m not getting error messages anymore but it doesn’t seem to be doing anything else. I just get this:

sean-patrickcourtney@SeanPatricksMBP TripleX % g++ triplex.cpp -o triplex
sean-patrickcourtney@SeanPatricksMBP TripleX %

and this:

sean-patrickcourtney@SeanPatricksMBP TripleX % g++ triplex.cpp -o triplex
sean-patrickcourtney@SeanPatricksMBP TripleX % ./triplex
sean-patrickcourtney@SeanPatricksMBP TripleX %

Any ideas? Or is what I’ve done correct?

Thanks

That is correct. The program doesn’t do anything yet.

@DanM

Okay, cool. Thank you. I’m also having trouble with the cl prompt for the Hello, World section. I’m not sure if it’s because I’m on a Mac or if it’s something else?

TripleX % cl triplex.cpp
zsh: command not found: cl

My apologies for all the questions, I’m completely new to this and still getting the hang of things.

Thanks
Sean

That’s for the compiler used on Windows. Compile how you did before using g++

Thank you. I’ve been trying to get the terminal to run the Hello World! program but I keep getting error messages too. I’m trying to follow the video, but not having any luck. Am I doing something wrong?

Thanks
Sean

You didn’t give g++ an output name (what -o does). By default g++ will name it “a.out” which you can see in your file explorer.
So triplex (without a file extension) is the program you initially made which does nothing and a.out is your new program that prints those messages.

Typing “./a.out” should show that.

Thank you. I managed to fix it.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms