[prev] 112 [next]

Compilers (cont)

Compilation/linking with gcc

gcc -c stack.c
// produces stack.o, from stack.c (and stack.h)

gcc -c numerals.c
// produces numerals.o, from numerals.c (and stack.h)

gcc -o prog numerals.o stack.o
// links numerals.o, stack.o and libraries
// producing executable program called prog

Note stdio,assert are included implicitly.

gcc is a multi-purpose tool

  • compiles (-c), links, makes executables (-o)