Searches the specified library file, libkey.so, and then libkey.a for dynamic linking, or just libkey.a for static linking.
The compiler default is to search only some of the compiler run-time libraries. The default configuration file specifies the default library names to search for with the -l compiler option, and the default search path for libraries with the -L compiler option.
You must also provide additional search path information for libraries not located in the default search path. The search path can be modified with the -Ldirectory option.
The C and C++ runtime libraries are automatically added.
The -l option is cumulative. Subsequent appearances of the -l option on the command line do not replace, but add to, the list of libraries specified by earlier occurrences of -l. Libraries are searched in the order in which they appear on the command line, so the order in which you specify libraries can affect symbol resolution in your application.
For more information, refer to the ld documentation for your operating system.
To compile myprogram.C and link it with library mylibrary (libmylibrary.a) found in the /usr/mylibdir directory, enter:
xlc++ myprogram.C -lmylibrary -L/usr/mylibdir
Specify Compiler Options in a Configuration File
Compiler Command Line Options
B
L
Appendix C, Libraries in XL C/C++