Chapter 2. Basics of Program Writing
Basics of GCC compiler
gcc -g -Wall -ohello hello.c
- The -g option enables debugging.
- The switch -Wall turns on the warnings.
- The switch -ohelllo tells the compiler that the program is to be called
hello
.
gcc -g -Wall -ansi -pedantic -ohello hello.c
- The switch -ansi turns off features of GNU C that are incompatible with ANSI C.
- The -pedantic switch causes the compiler to issue a warning for any non-ANSI feature it encounters.
Getting Help on Unix
Most Unix systems have an online document system called the manpages. To get information about a particular subject, use the following command:
man subject
For example, to find out about the classes defined in the printf function, you would type:
man printf
The command also has a keyword search mode:
man -k keyword
To determine the name of manpage with the word “output” in its title, use the command:
man -k output