Various options can be given when the compiler is invoked:
When used in the various stages of the compiling, typical commands would be:
.c .o:
The object file file1.o
is created (with debug-information) from the
sourcefile file1.c
.
.o, .a a.out:
gcc -o myprog file1.o file2.o file3.o main.o -L/home/john/lib -lmylib -lm
From all objectfiles (file1.o
, file2.o
, file3.o
and
main.o
) and some libraries (libmylib
in /home/john/lib
and libm
) the executable named myprog
is created.