Section 9.3. Finding Header and Library Files


9.3. Finding Header and Library Files

Header files that come with your Linux system are in the /usr/include directory hierarchy. The compiler will search for include files only in /usr/include by default. (Header files may be stored outside /usr/include, but they generally have links to them inside /usr/include; for example, at the time of writing, the X include files are in /usr/X11R6/include/X11, but a symbolic link is provided so that the compiler will find them through the /usr/include/X11 path instead.)

Libraries are much the same way, with a twist. Libraries that are considered critical to booting the system (and repairing it, if necessary) are in /lib. Other system libraries are in /usr/lib, except for X11R6 libraries, which are in /usr/X11R6/lib. The compiler will search for standard system libraries by default.

Some libraries are intended to support development on the same system against more than one major version of the library. In many of these cases, special configuration utilities are available to provide the correct version of the header files to include and the proper version of the libraries to link against. A unified tool called pkg-config provides this information for each version of every library that is built to support pkg-config.


    Linux Application Development
    Linux Application Development (paperback) (2nd Edition)
    ISBN: 0321563220
    EAN: 2147483647
    Year: 2003
    Pages: 168

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: