g++ command line arguments
Nic McPhee - UMM - Fall 1995
This is by no means a comprehensive list of the vast number of commands line options available in g++. I've merely tried to mention the most common or important ones for beginners.
g++
The standard name for the GNU C++ compiler.
-c
This command line argument tells the compiler that the file you're compiling isn't a complete program, and that instead of trying to generate a working executable, it will instead just generate the object code resulting from compiling that file. This object code is put in a file whose name ends in ".o". If, for example, your source file is "doug.cpp", the object file would be "doug.o".
-g
This command line argument tells the compiler to include a variety of information that makes it easier to use the GNU debugger (gdb). gdb is an excellent symbolic debugger, and I highly recommend you learn at least the basics of gdb.
-o
This command line argument tells the compiler what name to save the resulting executable under.
-Wall
This command line argument tells the compiler to W(arn) you about all the things it finds unusual. This can be very useful in pointing out silly mistakes that (unfortunately) result in legal C/C++, making them very hard to find. Several of the common mistakes Pascal programmers make when learning C++ can be caught by -Wall, so it's highly recommended.
Links:
http://www.morris.umn.edu/~mcphee/Courses/C_C%2B%2B_notes/Glossary/g%2B%2B_command_line_args.html
