You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LINK.exe links Common Object File Format (COFF) object files and libraries to create an executable (.exe) file or a dynamic-link library (DLL).
11
12
@@ -23,6 +24,8 @@ On the command line, linker options are not case-sensitive; for example, /base a
23
24
24
25
You can use the [comment](../../preprocessor/comment-c-cpp.md) pragma to specify some linker options.
25
26
27
+
## Linker options listed alphabetically
28
+
26
29
|Option|Purpose|
27
30
|------------|-------------|
28
31
|[@](at-specify-a-linker-response-file.md)|Specifies a response file.|
@@ -73,6 +76,8 @@ You can use the [comment](../../preprocessor/comment-c-cpp.md) pragma to specify
73
76
|[/KEYFILE](keyfile-specify-key-or-key-pair-to-sign-an-assembly.md)|Specifies a key or key pair to sign an assembly.|
74
77
|[/LARGEADDRESSAWARE](largeaddressaware-handle-large-addresses.md)|Tells the compiler that the application supports addresses larger than two gigabytes|
75
78
|[/LIBPATH](libpath-additional-libpath.md)|Specifies a path to search before the environmental library path.|
79
+
|[/LINKREPRO](linkrepro.md)|Specifies a path to generate link repro artifacts in.|
80
+
|[/LINKREPROTARGET](linkreprotarget.md)|Generates a link repro only when producing the specified target.|
Tells the linker or library tool to generate a link repro in a specified directory.
11
+
12
+
## Syntax
13
+
14
+
> **/LINKREPRO:**_directory-name_
15
+
16
+
### Arguments
17
+
18
+
**/LINKREPRO:**_directory-name_\
19
+
The user-specified directory to store the link repro in. Directory names that include spaces must be enclosed in double quotes.
20
+
21
+
## Remarks
22
+
23
+
The **/LINKREPRO** option is used to create a *link repro*. It's a set of build artifacts that allow Microsoft to reproduce a problem that occurs at link time, or during library operations. It's useful for problems such as a backend crash involving Link-Time Code Generation (LTCG), an LNK1000 linker error, or a linker crash. The tool produces a link repro when you specify the **/LINKREPRO** linker option, or when you set the `link_repro` environment variable in your command-line build environment. For more information, see the [Link repros](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md#link-repros) section of [How to report a problem with the Microsoft C++ toolset](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md).
24
+
25
+
Both the **/LINKREPRO** linker option and the `link_repro` environment variable require you to specify an output directory for the link repro. On the command line or in the IDE, specify the directory by using a **/LINKREPRO:**_directory-name_ option. The _directory-name_ you specify may be an absolute or relative path, but the directory must exist. The command-line option overrides any directory value set in the `link_repro` environment variable.
26
+
27
+
For information on how to limit link repro generation to a specific target file name, see the [/LINKREPROTARGET](linkreprotarget.md) option. This option can be used to specify a specific target to generate a link repro for. It's useful in complex builds that invoke the linker or library tool more than once.
28
+
29
+
### To set this linker option in the Visual Studio development environment
30
+
31
+
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
1. Enter the **/LINKREPRO:**_directory-name_ option in the **Additional Options** box. The _directory-name_ value you specify must exist. Choose **OK** to apply the change.
36
+
37
+
Once you've generated the link repro, open this property page again to remove the **/LINKREPRO** option from your builds.
38
+
39
+
### To set this linker option programmatically
40
+
41
+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.
Tells the linker or library tool to generate a link repro only when the target has the specified file name.
11
+
12
+
## Syntax
13
+
14
+
> **/LINKREPROTARGET:**_file-name_
15
+
16
+
### Arguments
17
+
18
+
**/LINKREPROTARGET:**_file-name_\
19
+
The target file name to filter on. A link repro is only generated when the named file is the output target. File names that include spaces must be enclosed in double quotes. The file name should include the base name and the extension, but not the path.
20
+
21
+
## Remarks
22
+
23
+
The **/LINKREPROTARGET** option is used to specify a target file name to generate a *link repro* for. A link repro is a set of build artifacts that allow Microsoft to reproduce a problem that occurs at link time, or during library operations. The linker or library tool produces a link repro when you specify the [/LINKREPRO](linkrepro.md) option, or when you set the `link_repro` environment variable in your command-line build environment.
24
+
25
+
The **/LINKREPROTARGET** option is useful in complex builds that invoke the linker or library tool more than once. It lets you specify a specific target for the link repro, such as *problem.dll*. It lets you generate the link repro only when the tool produces a specific file.
26
+
27
+
For more information about how and when to create a link repro, see the [Link repros](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md#link-repros) section of [How to report a problem with the Microsoft C++ toolset](../../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md).
28
+
29
+
The **/LINKREPRO** and [/OUT](out-output-file-name.md) options must be set for the **/LINKREPROTARGET** option to have any effect.
30
+
31
+
### To set this linker option in the Visual Studio development environment
32
+
33
+
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
Copy file name to clipboardExpand all lines: docs/build/reference/overview-of-lib.md
+23-20Lines changed: 23 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
---
2
2
title: "Overview of LIB"
3
-
ms.date: "11/04/2016"
3
+
description: Overview of the use and options of the library tool, lib.exe.
4
+
ms.date: "09/25/2019"
4
5
f1_keywords: ["Lib"]
5
6
helpviewer_keywords: ["LIB [C++], modes"]
6
7
ms.assetid: e997d423-f574-434f-8b56-25585d137ee0
7
8
---
8
9
# Overview of LIB
9
10
10
-
LIB creates standard libraries, import libraries, and export files you can use with [LINK](linker-options.md) when building a program. LIB runs from a command prompt.
11
+
LIB (lib.exe) creates standard libraries, import libraries, and export files you can use with [LINK](linker-options.md) when building a program. LIB runs from a command prompt.
11
12
12
13
You can use LIB in the following modes:
13
14
@@ -19,29 +20,31 @@ You can use LIB in the following modes:
19
20
20
21
These modes are mutually exclusive; you can use LIB in only one mode at a time.
21
22
22
-
## Lib Options
23
+
## LIB options
23
24
24
25
The following table lists the options for lib.exe, with a link to more information.
25
26
26
27
|Option|Description|
27
28
|-|-|
28
-
|**/DEF**|Create an import library and an export file.<br/><br/>For more information see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
29
-
|**/ERRORREPORT**| Send information to Microsoft about internal errors with lib.exe.<br/><br/>For more information see [Running LIB](running-lib.md).|
30
-
|**/EXPORT**| Exports a function from your program.<br/><br/>For more information see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
31
-
|**/EXTRACT**| Create an object (.obj) file that contains a copy of a member of an existing library.<br/><br/>For more information see [Extracting a Library Member](extracting-a-library-member.md).|
32
-
|**/INCLUDE**| Adds a symbol to the symbol table.<br/><br/>For more information see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
33
-
|**/LIBPATH**| Overrides the environment library path.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
34
-
|**/LIST**| Displays information about the output library to standard output.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
35
-
|**/LTCG**| Causes the library to be built using link-time code generation.<br/><br/>For more information see [Running LIB](running-lib.md).|
36
-
|**/MACHINE**| Specifies the target platform for the program.<br/><br/>For more information see [Running LIB](running-lib.md).|
37
-
|**/NAME**| When building an import library, specifies the name of the DLL for which the import library is being built.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
38
-
|**/NODEFAULTLIB**| Removes one or more default libraries from the list of libraries it searches when resolving external references.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
39
-
|**/NOLOGO**| Suppresses display of the LIB copyright message and version number and prevents echoing of command files.<br/><br/>For more information see [Running LIB](running-lib.md).|
40
-
|**/OUT**| Overrides the default output filename.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
41
-
|**/REMOVE**| Omits an object from the output library.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
42
-
|**/SUBSYSTEM**| Tells the operating system how to run a program created by linking to the output library.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
43
-
|**/VERBOSE**| Displays details about the progress of the session, including names of the .obj files being added.<br/><br/>For more information see [Running LIB](running-lib.md).|
44
-
|**/WX**| Treat warnings as errors.<br/><br/>For more information see [Running LIB](running-lib.md).|
29
+
|**/DEF**|Create an import library and an export file.<br/><br/>For more information, see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
30
+
|**/ERRORREPORT**| Send information to Microsoft about internal errors with lib.exe.<br/><br/>For more information, see [Running LIB](running-lib.md).|
31
+
|**/EXPORT**| Exports a function from your program.<br/><br/>For more information, see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
32
+
|**/EXTRACT**| Create an object (.obj) file that contains a copy of a member of an existing library.<br/><br/>For more information, see [Extracting a Library Member](extracting-a-library-member.md).|
33
+
|**/INCLUDE**| Adds a symbol to the symbol table.<br/><br/>For more information, see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
34
+
|**/LIBPATH**| Overrides the environment library path.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
35
+
|**/LINKREPRO**| Creates artifacts needed to reproduce a lib.exe crash or internal error.<br/><br/>For more information, see [Running LIB](running-lib.md).|
36
+
|**/LINKREPROTARGET**| Only generates the **/LINKREPRO** artifacts when lib.exe is used with a specified file.<br/><br/>For more information, see [Running LIB](running-lib.md).|
37
+
|**/LIST**| Displays information about the output library to standard output.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
38
+
|**/LTCG**| Causes the library to be built using link-time code generation.<br/><br/>For more information, see [Running LIB](running-lib.md).|
39
+
|**/MACHINE**| Specifies the target platform for the program.<br/><br/>For more information, see [Running LIB](running-lib.md).|
40
+
|**/NAME**| When building an import library, specifies the name of the DLL for which the import library is being built.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
41
+
|**/NODEFAULTLIB**| Removes one or more default libraries from the list of libraries it searches when resolving external references.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
42
+
|**/NOLOGO**| Suppresses display of the LIB copyright message and version number and prevents echoing of command files.<br/><br/>For more information, see [Running LIB](running-lib.md).|
43
+
|**/OUT**| Overrides the default output filename.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
44
+
|**/REMOVE**| Omits an object from the output library.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
45
+
|**/SUBSYSTEM**| Tells the operating system how to run a program created by linking to the output library.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
46
+
|**/VERBOSE**| Displays details about the progress of the session, including names of the .obj files being added.<br/><br/>For more information, see [Running LIB](running-lib.md).|
47
+
|**/WX**| Treat warnings as errors.<br/><br/>For more information, see [Running LIB](running-lib.md).|
0 commit comments