### Link with Library Files

The linker uses library (.LIB) files to resolve external references from code in the object (.OBJ) files and from other library files. When the linker finds a function or data reference in an object file that requires a module from a library, the linker links the module from the library to the output file.

The compiler embeds the names of needed libraries (called default libraries) in object files. You do not need to specify these libraries: the linker searches them automatically.

Specify library files only when:

- You want to use libraries other than the default libraries. Libraries you specify are searched ahead of the default libraries.
- You want to specify the default library with its full path, because the default library is not in the current directory, and not in a directory specified in the LIB environment variable You can also specify a path to a directory, without specifying a file name, to have the linker search that directory before the directories in the LIB environment variable

To ignore the default libraries, use the /NODEFAULTLIBRARYSEARCH option. Use the option with care, because most compilers expect their object files to be linked with default libraries.

If you want to include all of a library's objects in the output file, instead of only the required ones, you must link with the /NOFREE option, to use the LINK386-compatible syntax. You can then enter the library name as an object file.

Static and Dynamic Linking

Set Linker Options