Standard Libraries (cont)
By default, gcc links /usr/lib/libc.a to all executables
Typing “man 3 intro” will give a list of most of the standard library functions
Any other libraries must be explicitly linked by referring to the absolute pathname of the library, or preferably by using the “-l” gcc switch:
gcc *.o /usr/lib/libm.a -o mathExamples
gcc *.o -lm -o mathExamples
These .a files are also sometimes referred to as static libraries
Often you will find for each system .a file a corresponding .so file, referred to as a shared object (not needed for this course)
Advantage of shared objects: smaller executable files (library functions loaded at run time)