-qlib

Category

Linking

Pragma equivalent

None.

Purpose

Specifies whether standard system libraries and XL C libraries are to be linked.

When -qlib is in effect, the standard system libraries and compiler libraries are automatically linked. When -qnolib is in effect, the standard system libraries and compiler libraries are not used at link time; only the libraries specified on the command line with the -l flag will be linked.

This option can be used in system programming to disable the automatic linking of unneeded libraries.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-lib---.   
>>- -q--+-nolib-+----------------------------------------------><

Defaults

-qlib

Usage

Using -qnolib specifies that no libraries, including the system libraries as well as the XL C libraries (these are found in the lib/aix51/, lib/aix52/, and lib/aix53/ subdirectories of the compiler installation directory), are to be linked. The system startup files are still linked, unless -qnocrt is also specified.

Note that if your program references any symbols that are defined in the standard libraries or compiler-specific libraries, link errors will occur. To avoid these unresolved references when compiling with -qnolib, be sure to explicitly link the required libraries by using the command flag -l and the library name.

Predefined macros

None.

Examples

To compile myprogram.c without linking to any libraries except the compiler library libxlopt.a, enter:
xlc myprogram.c -qnolib -lxlopt

Related information