Often, it is useful to compile a a simple program from the command line. The steps to do so are listed below.
tag4622:~ labuser$ cd /Users/labuser/Desktop/CS120Lab1JaneDoe
g++ -o Lab1 Lab1.cpp
Here, g++ invokes the C++ compiler, the -o option specifies the name of the created object file (the executable is Lab1 for this example), and Lab1.cpp is the source file to be compiled. You should see a prompt similar to the one below:
tag4622:~ CS120Lab1JaneDoe$ g++ -o Lab1 Lab1.cpp
tag4622:~ CS120Lab1JaneDoe$ ./Lab1