gcc compiler some parameter differences (-I-L-L)

Source: Internet
Author: User

When we compile the program with GCC, we often use "I" (uppercase I), "L" (capital L), "L" (lowercase l), and so on, and then make a record:

Cases:

Gcc-o Hello hello.c   -i/home/hello/include   -l/home/hello/lib    -lworld

The above sentence means that when compiling the HELLO.C:

-i/home/hello/include, which means that the/home/hello/include directory will be the first directory to look for headers , in the following order:/home/hello/include–>/usr/ Include–>/usr/local/include is the directory that specifies priority lookup, find the default directory

-l/home/hello/lib, which means that the/home/hello/lib directory is the first directory to look for a library file , in the order of:/home/hello/lib–>/lib–>/usr/lib–> /usr/local/lib Ditto, also specifies the directory of priority lookup

-L Word, meaning * * Looking for dynamic link library file **libword.so (that is, the file name removed from the prefix and the suffix represented by the library file) if you add the compilation option-static, to find the static link library file, that is LIBWORD.A

For a third-party-provided dynamic-link library (. So), it is generally copied to a Lib directory (/usr/local/lib), or the directory with-L is specified, and then uses-l to specify its name

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.