[prev] 103 [next]

Compilers (cont)

Compilation/linking with gcc

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

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

gcc -o prog brackets.o Stack.o
// links brackets.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)