- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Background on the C Language
- Elements of the C++ Language
- Project Management Tools
- GNU C/C++ Compiler Command-Line Switches
- New Features of the GNU egcs Compiler System
- Additional Resources
- Summary
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
GNU C/C++ Compiler Command-Line Switches
If you loaded the development tools when you installed Linux (or later using RPM), you should have the GNU C/C++ compiler (gcc). Many different options are available for the GNU C/C++ compiler, and many of them match the C and C++ compilers available on other UNIX systems. Table 24.1 shows the important switches. Look at the man page or info file for gcc for a full list of options and descriptions.
Table 24.1. GNU C/C++ Compiler Switches
| Switch | Description |
| -x language | Specifies the language (C, C++, Java, and assembler are valid values). |
| -c | Compiles and assembles only (does not link). |
| -S | Compiles (does not assemble or link); generates an assembler code (.s) file. |
| -E | Preprocesses only (does not compile, assemble, or link). |
| -o file | Specifies the output filename (a.out is the default). |
| -l library | Specifies the libraries to use. |
| -I directory | Searches the specified directory for include files. |
| -w | Inhibits warning messages. |
| -pedantic | Strict ANSI compliance required. |
| -Wall | Prints additional warning messages. |
| -g | Produces debugging information (for use with gdb). |
| -ggdb | Generates native-format debugging info (and gdb extensions). |
| -p | Produces information required by gprof. |
| -pg | Produces information for use by gprof. |
| -O | Optimizes. |
The compilation process takes place in several steps:
- First, the C preprocessor parses the file. To do so, it sequentially reads the lines, includes header files, and performs macro replacement.
- The compiler parses the modified code for correct syntax. This builds a symbol table and creates an intermediate object format. Most symbols have specific memory addresses assigned, although symbols defined in other modules, such as external variables, do not.
- The last compilation stage, linking, ties together different files and libraries and then links the files by resolving the symbols that had not previously been resolved.
New Features of the GNU egcs Compiler System | Next Section

Account Sign In
View your cart