How to include needed C library using gcc?
Use the -l
command line option. You can specify the library search path with the -L
option. E.g:
gcc -o myprogram -lfoo -L/home/me/foo/lib myprogram.c
This will link myprogram
with the static library libfoo.a
in the folder /home/me/foo/lib
.
-I<search path to include files>
-L<search path to the lib file>
-l<libname>