GCC link Library

Source: Internet
Author: User

-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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.