This should help you to start programming in C++ using the Unix compilers available here at the University of Michigan.
g++ -o p1 p1.cpp -lm
g++ is one of the names for the GNU C++ compiler. "p1.cpp" names the file
containing the source code. The "-o" option means that the following file
name should be used as the name of the executable file ("a.out" is assumed
if you leave the "-o
p1
The program will start running and the output will appear on your display.
To interrupt the program, type control-C, and you will get a Unix command
line prompt again.
To use a debugger, you must tell the compiler to save the symbol table information. Do this with the "-g" option in the compile command, as in:
g++ -o p1 -g p1.cpp -lm
We will be providing a debugger QuickStart soon.
To avoid having to retype the compile command every time, use the "make" utility. This is helpful even for simple projects, but is essential for complex projects later in the course, so we recommend that you get started using it now.