3.2. Compile, Assemble, and Link from Source Code

To compile the code, use the following command:

gcc -g hello.c -o hello

The -g option generates debugging information and -o specifies the name of the executable to be produced. Both of these can be omitted. Other useful options include -O to enable standard optimizations and -O2 for extensive optimizations. If no -O is specified, GCC will not optimize.

See Using the GNU Compiler Collection (GCC) for additional basic compiler information.