A simple compilation

[Image unavailable]

Compiling a small C program requires at least a single .c file, with .h files as appropriate. Although the command to perform this task is simply cc file.c, there are 3 steps to obtain the final executable program, as shown:

  1. Compiler stage: All C language code in the .c file is converted into a lower-level language called Assembly language; making .s files.
  2. Assembler stage: The assembly language code made by the previous stage is then converted into object code which are fragments of code which the computer understands directly. An object code file ends with .o.
  3. Linker stage: The final stage in compiling a program involves linking the object code to code libraries which contain certain "built-in" functions, such as printf. This stage produces an executable program, which is named a.out by default.

PreviousNextIndex

Last updated on Wednesday, June 21, 1995 by Ben Y. Yoshino
Copyright © 1995 University of Hawai`i, College of Engineering, Computer Facility
All rights reserved.