-L is the name of a library directly, such as-LC is the LIBC library
-L is the path to the library, and the search takes precedence in the-L directory
-l Specifies the path of the library,-l specifies the name of the library LIBXML2 can write this-lxm2
Search path order when static library links:
1. LD will go to the parameters in the GCC command-l
2. Re-search for GCC environment variables Library_path
3. Find the default directory/lib/usr/lib/usr/local/lib This is the original compile GCC when written in the program
Dynamic Link-time, execution-time search path order:
1. The dynamic library search path specified when compiling the target code
2. Environment variable LD_LIBRARY_PATH the specified dynamic library search path
3. The dynamic library search path specified in configuration file/etc/ld.so.conf
4. Default dynamic library search path/lib
5. Default dynamic Library search path/usr/lib
About environment variables:
Library_path environment variable: Specifies the program static link library file search path
LD_LIBRARY_PATH environment variable: Specifies the program dynamic link library file search path
GCC link Library