Why bind libraries (for example, pthread) when they are in the right folders "/ lib" and "/ usr / lib"?

1. Why do we need to link custom libraries / include custom header files if they are already 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 manual page ld.so/ld-linux.so - dynamic linker/loaderindicates that the required libraries are required by the program. In the default path /lib, and then /usr/lib. When the .so library file is already in the / lib folder, why should I link it exclusively. The option is -lused to link static libraries. but when I do the process pmap, I see that the dynamic pthread library is used with the extension .so, and not with the extension .a. Similarly

anirudh@anirudh-Aspire-5920:~/Documents/DUMP$ locate mysql.h
/usr/include/mysql/mysql.h
anirudh@anirudh-Aspire-5920:~/Documents/DUMP$

/usr/include, , -I.

+5
1
  • /lib /usr/lib , , . - , , , , . -l - , . , , (Visual ++ ), Linux.
  • -l , . , , -static.
  • #include <mysql/mysql.h>, /usr/include/mysql/mysql.h . - <mysql.h > , /usr/include/mysql.h, /usr/include/mysql/mysql.h.
+10

All Articles