|
|
$ gcc -Wall calc.c /usr/lib/libm.a -o calc |
|
Correct Order |
$ gcc -Wall calc.c -lm -o calc |
Error! |
Incorrect Order |
$ gcc -Wall -lm calc.c -o calc |
In general, the compiler option ‘-lNAME’ will attempt to link object files with a library file ‘libNAME.a’ in the standard library directories.
On systems supporting both 64 and 32-bit executables, the 64-bit versions of the libraries will often be stored in ‘/usr/lib64’ and ‘/lib64’, with the 32-bit versions in ‘/usr/lib’ and ‘/lib’.