INTRODUCTION TO THE GNU PROGRAMMING TOOLS The Free Software Foundation has developed a complete set of system utilities as part of the GNU Project. You will use "g++" (a C++ translator) and "gdb" (a debugger) as you work on your assignments for this course. On most systems, it takes four steps to translate a C++ program into an executable program: preprocessing, compilation, assembly, and linking. The "g++" utility provides a convenient interface to accomplish these tasks. For example, to translate the C++ program contained in "fileA.cpp": g++ fileA.cpp By default, the resulting executable program is stored in the file "a.out". If the C++ program is contained in more than one file, you simply list all of the relevant file names and "g++" does the processing steps in the correct order (each file is translated into object code and then all are linked). There are a number of useful options that you can use with "g++": -Wall Issue warning messages for source code which is syntactically correct but appears to contain constructs you may wish to avoid. -g Insert additional information into the executable program for use with a debugger (such as "gdb"). -c Halt the translation process after assembly and before linking (the resulting object code files end with ".o"). More than one option can be specified. For example: g++ -Wall -c fileB.cpp fileC.cpp Here, "g++" will issue warning messages for any suspect statements it finds in either "fileB.cpp" or "fileC.cpp". It will also generate two object code files ("fileB.o" and "fileC.o") that correspond to the two source code files. The "gdb" debugger can be useful to assist you in locating execution-time errors in your programs. First, translate your source code program using the "-g" option, then execute the debugger: g++ -g fileA.cpp gdb a.out Once the debugger is executing, you can issue commands to control execution of your program. Some of the basic commands are listed below: run Start executing your program. quit Exit from the debugger. where Identify the location where your program halted. list Display the source code lines near the current position. Additional information about "g++" and "gdb" is available via the "man" utility and other on-line documents.