Appendix G
C++ Compilers
Choosing, Installing, and learning to use a C++ compiler may be the most difficult part of this course. This appendix will provide you with some guidance that will hopefully make the process easier.
Because the C++ compilers come from a variety of software companies, there is no one way to install and use a C++ compiler. To make the process easier, the Web site that accompanies this book includes information specific to the major compilers. For the most up-to-date information, including quick references for common compilers, see the address below.
General C++ Compiler Notes
- Because C++ was written to be a portable language, the programs in this book can be run on DOS, Windows, Unix, or Macintosh compilers with a few exceptions. Minor inconsistencies may appear, especially in the way input and output is handled.
- Working with data files often exposes minor variations in the way C++ compilers handle input and output. Test data file input and output with your compiler before allowing students to begin that lesson.
- Use the most recent version of the compiler software your computer can run. Some older C++ compilers do not support the latest features of the language. For example, some older compilers do not support template classes, making it impossible to use the vector and matrix classes.
- Verify whether your compiler includes the bool data type. See Appendix E for more information about the bool data type.
- Most C++ compilers have a feature to group source code files into a project or workspace. When you begin to use classes, you will have to know how to create a project and add the required fields to the project.
- Learning to use your compiler’s debugger can be a powerful teaching tool.
- C++ has only basic screen formatting capabilities. Most compilers do not even include a clear screen command. The Web site previously mentioned will have some pointers for you. As a general rule, however, you should not expect to be able to create intricately formatted output using standard C++ features.
- With some compilers, especially when running under Microsoft Windows, you may experience a situation in which the output of your program appears in a window and disappears almost immediately. If you compiler does not have a built-in feature to pause the output, you can include an additional input statement at the end of your program to cause execution to pause. Examples are available on the Web site mentioned.
- Sending output to a printer also varies among compilers and among operating systems. Examples are available on the Web site given earlier.
- The Web site of the company that developed the compiler you are using is a good resource. Links to the major compiler developers are available at the Web address mentioned earlier.