I have a very small c++ program that consists of two files: main.cpp and something.cpp. I’d like to compile my program using g++ in the OS X Terminal. Here’s what I’ve tried:
> g++ main.cpp something.cpp
> ./a.out
Is this correct? I’ve come across examples that use the -o flag. I’m not sure if that’s necessary.
-ooption is not required. If not specified, the default behavior is to put an executable file in “a.out”:So yes, this is correct.