Overview of LIB

LIB (lib.exe) creates standard libraries, import libraries, and export files you can use with LINK when building a program. LIB runs from a command prompt.

You can use LIB in the following modes:

These modes are mutually exclusive; you can use LIB in only one mode at a time.

LIB options

The following table lists the options for lib.exe, with a link to more information.

Option Description
/DEF Create an import library and an export file.

For more information, see Building an Import Library and Export File.
/ERRORREPORT Deprecated. For more information, see Running LIB.
/EXPORT Exports a function from your program.

For more information, see Building an Import Library and Export File.
/EXTRACT Create an object (.obj) file that contains a copy of a member of an existing library.

For more information, see Extracting a Library Member.
/INCLUDE Adds a symbol to the symbol table.

For more information, see Building an Import Library and Export File.
/LIBPATH Overrides the environment library path.

For more information, see Managing a Library.
/LINKREPRO Creates artifacts needed to reproduce a lib.exe crash or internal error.

For more information, see Running LIB.
/LINKREPROTARGET Only generates the /LINKREPRO artifacts when lib.exe is used with a specified file.

For more information, see Running LIB.
/LIST Displays information about the output library to standard output.

For more information, see Managing a Library.
/LTCG Causes the library to be built using link-time code generation.

For more information, see Running LIB.
/MACHINE Specifies the target platform for the program.

For more information, see Running LIB.
/NAME When building an import library, specifies the name of the DLL for which the import library is being built.

For more information, see Managing a Library.
/NODEFAULTLIB Removes one or more default libraries from the list of libraries it searches when resolving external references.

For more information, see Managing a Library.
/NOLOGO Suppresses display of the LIB copyright message and version number and prevents echoing of command files.

For more information, see Running LIB.
/OUT Overrides the default output filename.

For more information, see Managing a Library.
/REMOVE Omits an object from the output library.

For more information, see Managing a Library.
/SUBSYSTEM Tells the operating system how to run a program created by linking to the output library.

For more information, see Managing a Library.
/VERBOSE Displays details about the progress of the session, including names of the .obj files being added.

For more information, see Running LIB.
/WX Treat warnings as errors.

For more information, see Running LIB.

See also

LIB Reference
LIB Input Files
LIB Output Files
Other LIB Output
Structure of a Library