1. Why do we need to link the non standard libraries/include non standard header files when they are already present in the right folder
anirudh@anirudh-Aspire-5920:~/Documents/DUMP$ locate libpthread
/lib/libpthread-2.12.1.so
/lib/libpthread.so.0
/usr/lib/libpthread.a
/usr/lib/libpthread.so
/usr/lib/libpthread_nonshared.a
/usr/lib/xen/libpthread.a
/usr/lib/xen/libpthread_nonshared.a
anirudh@anirudh-Aspire-5920:
The man page of ld.so/ld-linux.so - dynamic linker/loader
says that the necessary libraries required by a program are searched In the default path /lib, and then /usr/lib.
When my library's .so file is already there in /lib folder then why do I need to link it exclusively.
Also the -l
option is used to link static libraries. but when I do pmap of the process I see that the dynamic library of pthread with .so
extension is being used rather than the one with .a
extension.
Similarly
anirudh@anirudh-Aspire-5920:~/Documents/DUMP$ locate mysql.h
/usr/include/mysql/mysql.h
anirudh@anirudh-Aspire-5920:~/Documents/DUMP$
When it is already present in the folder /usr/include
which is the standard folder for all header files then why do I need to include it exclusively using -I
option.