Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
192fe87
Create /ZH:SHA_356 article
Sep 17, 2019
e3910e0
Add /ZH:SHA_256 to TOC
Sep 17, 2019
c9309f5
Update verbiage
Sep 17, 2019
7195118
actually added new file
Sep 18, 2019
1c8a387
new images
Sep 18, 2019
e7f4f2e
Update per review comments
Sep 19, 2019
57f0dba
new edits
Sep 19, 2019
1c23c31
new files
Sep 23, 2019
41ea4d9
new images and text for setting preferences
Sep 23, 2019
53e9df5
slight rewording
Sep 23, 2019
6e81a10
new image for window layout
Sep 23, 2019
aab3f1f
additional edits per review
Sep 24, 2019
7cb6cf0
new text and images on color schemes
Sep 24, 2019
3906fd0
added images this time
Sep 24, 2019
2a06815
added toc entry and updated wording
Sep 24, 2019
88f6269
Initial draft of /LINKREPRO and related options
Sep 25, 2019
4df6315
new filters topic and toc entry
Sep 25, 2019
e569c9f
added new files
Sep 25, 2019
7ef1868
additional tweaks
Sep 25, 2019
7ca93ef
new example
Sep 25, 2019
debe27c
fixed headings and titles
Sep 25, 2019
4bf4136
fixed various things
Sep 25, 2019
7ebf237
moved some text around
Sep 25, 2019
945c45a
fixed folder name
Sep 25, 2019
05d2ac3
fix per review
Sep 25, 2019
e4e6d3d
updates per review
Sep 25, 2019
2879d8f
Add references to linkrepro topics
Sep 25, 2019
01af9d3
updates per Olga
Sep 26, 2019
e00282e
updates per peer review
Sep 26, 2019
1954c2a
added missing comma
Sep 26, 2019
f2cbb18
Fixes per comments by Kevin, YongKang
Sep 26, 2019
328d8c4
Add LIB options per Kevin
Sep 26, 2019
b1f3771
Acrolinx, clarity, versioning
Sep 26, 2019
6ffabc9
fixes per PR review
Sep 26, 2019
117b642
fixed metadata
Sep 27, 2019
d275410
Merge pull request #2356 from mikeblome/mb-prefs
tiburd Sep 27, 2019
85b9b69
Merge pull request #2335 from corob-msft/cr-zh-sha-256
Jak-MS Sep 27, 2019
36dfc8e
changed title to be more accurate
Sep 27, 2019
242ea0b
fixed links to newly titled topic
Sep 27, 2019
291ed80
Add Microsoft-specific calloc behavior for 1590
Sep 27, 2019
e0d1ed9
Merge pull request #2361 from mikeblome/mb-filters
Jak-MS Sep 27, 2019
8c45262
Update calloc headers
Sep 27, 2019
6fa6553
Merge pull request #2368 from corob-msft/cr-1590
PRMerger15 Sep 27, 2019
4855748
Merge pull request #2366 from mikeblome/mb-1064
v-albemi Sep 27, 2019
b35ecad
More updates per YongKang
Sep 27, 2019
cb8bca0
Fix issues caused by 2364
Sep 28, 2019
2fee96c
Merge pull request #2369 from corob-msft/cr-undo-2364
PRMerger16 Sep 28, 2019
8874761
tweak content
Sep 29, 2019
59aeb70
Merge pull request #2363 from corob-msft/cr-linkrepro
ShannonLeavitt Sep 30, 2019
1e6386b
Merge pull request #2371 from MicrosoftDocs/master
Taojunshen Sep 30, 2019
c211cbd
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs…
opbld15 Sep 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ The following is a comprehensive alphabetical list of compiler options. For a ca
|[/Ze](za-ze-disable-language-extensions.md)|Deprecated. Enables language extensions.|
|[/Zf](zf.md)|Improves PDB generation time in parallel builds.|
|[/Zg](zg-generate-function-prototypes.md)|Removed in Visual Studio 2015. Generates function prototypes.|
|[/ZH](zh.md)|Specifies MD5, SHA-1, or SHA-256 for checksums in debug info.|
|[/ZI](z7-zi-zi-debug-information-format.md)|Includes debug information in a program database compatible with Edit and Continue.|
|[/Zi](z7-zi-zi-debug-information-format.md)|Generates complete debugging information.|
|[/Zl](zl-omit-default-library-name.md)|Removes default library name from .obj file (x86 only).|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ This article contains a categorical list of compiler options. For an alphabetica
|[/Zc](zc-conformance.md)|Specifies standard behavior under [/Ze](za-ze-disable-language-extensions.md).|
|[/Ze](za-ze-disable-language-extensions.md)|Deprecated. Enables C89 language extensions.|
|[/Zf](zf.md)|Improves PDB generation time in parallel builds.|
|[/ZH](zh.md)|Specifies MD5, SHA-1, or SHA-256 for checksums in debug info.|
|[/ZI](z7-zi-zi-debug-information-format.md)|Includes debug information in a program database compatible with Edit and Continue. (x86 only)|
|[/Zi](z7-zi-zi-debug-information-format.md)|Generates complete debugging information.|
|[/Zl](zl-omit-default-library-name.md)|Removes the default library name from the .obj file.|
Expand Down
13 changes: 9 additions & 4 deletions docs/build/reference/linker-options.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
title: "MSVC Linker Options"
ms.date: "08/20/2018"
title: "MSVC Linker options"
description: A list of the options supported by the Microsoft LINK linker.
ms.date: "09/24/2019"
f1_keywords: ["link"]
helpviewer_keywords: ["linker [C++]", "linker [C++], options listed", "libraries [C++], linking to COFF", "LINK tool [C++], linker options"]
ms.assetid: c1d51b8a-bd23-416d-81e4-900e02b2c129
---
# Linker Options
# Linker options

LINK.exe links Common Object File Format (COFF) object files and libraries to create an executable (.exe) file or a dynamic-link library (DLL).

Expand All @@ -23,6 +24,8 @@ On the command line, linker options are not case-sensitive; for example, /base a

You can use the [comment](../../preprocessor/comment-c-cpp.md) pragma to specify some linker options.

## Linker options listed alphabetically

|Option|Purpose|
|------------|-------------|
|[@](at-specify-a-linker-response-file.md)|Specifies a response file.|
Expand Down Expand Up @@ -73,6 +76,8 @@ You can use the [comment](../../preprocessor/comment-c-cpp.md) pragma to specify
|[/KEYFILE](keyfile-specify-key-or-key-pair-to-sign-an-assembly.md)|Specifies a key or key pair to sign an assembly.|
|[/LARGEADDRESSAWARE](largeaddressaware-handle-large-addresses.md)|Tells the compiler that the application supports addresses larger than two gigabytes|
|[/LIBPATH](libpath-additional-libpath.md)|Specifies a path to search before the environmental library path.|
|[/LINKREPRO](linkrepro.md)|Specifies a path to generate link repro artifacts in.|
|[/LINKREPROTARGET](linkreprotarget.md)|Generates a link repro only when producing the specified target.|
|[/LTCG](ltcg-link-time-code-generation.md)|Specifies link-time code generation.|
|[/MACHINE](machine-specify-target-platform.md)|Specifies the target platform.|
|[/MANIFEST](manifest-create-side-by-side-assembly-manifest.md)|Creates a side-by-side manifest file and optionally embeds it in the binary.|
Expand Down Expand Up @@ -125,5 +130,5 @@ For more information, see [Compiler-Controlled LINK Options](compiler-controlled

## See also

[C/C++ Building Reference](c-cpp-building-reference.md)<br/>
[C/C++ Building Reference](c-cpp-building-reference.md)\
[MSVC linker reference](linking.md)
47 changes: 47 additions & 0 deletions docs/build/reference/linkrepro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: "/LINKREPRO (Link repro directory name)"
description: Linker or library tool option to set the directory for a link repro.
ms.date: "09/24/2019"
f1_keywords: ["/LINKREPRO"]
helpviewer_keywords: ["LINKREPRO linker option", "/LINKREPRO linker option", "-LINKREPRO linker option", "linker repro reporting"]
---
# /LINKREPRO (Link repro directory name)

Tells the linker or library tool to generate a link repro in a specified directory.

## Syntax

> **/LINKREPRO:**_directory-name_

### Arguments

**/LINKREPRO:**_directory-name_\
The user-specified directory to store the link repro in. Directory names that include spaces must be enclosed in double quotes.

## Remarks

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).

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.

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.

### To set this linker option in the Visual Studio development environment

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. Select the **Configuration Properties** > **Linker** > **Command Line** property page.

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.

Once you've generated the link repro, open this property page again to remove the **/LINKREPRO** option from your builds.

### To set this linker option programmatically

- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.

## See also

[MSVC linker reference](linking.md)\
[MSVC linker options](linker-options.md)\
[/LINKREPROTARGET](linkreprotarget.md)
47 changes: 47 additions & 0 deletions docs/build/reference/linkreprotarget.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: "/LINKREPROTARGET (Link repro file name)"
description: Linker or library tool option to set a target file name for a link repro.
ms.date: "09/24/2019"
f1_keywords: ["/LINKREPROTARGET"]
helpviewer_keywords: ["LINKREPROTARGET linker option", "/LINKREPROTARGET linker option", "-LINKREPROTARGET linker option", "linker repro reporting"]
---
# /LINKREPROTARGET (Link repro file name)

Tells the linker or library tool to generate a link repro only when the target has the specified file name.

## Syntax

> **/LINKREPROTARGET:**_file-name_

### Arguments

**/LINKREPROTARGET:**_file-name_\
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.

## Remarks

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.

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.

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).

The **/LINKREPRO** and [/OUT](out-output-file-name.md) options must be set for the **/LINKREPROTARGET** option to have any effect.

### To set this linker option in the Visual Studio development environment

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. Select the **Configuration Properties** > **Linker** > **Command Line** property page.

1. Enter the **/LINKREPROTARGET:**_file-name_ option in the **Additional Options** box. Choose **OK** to apply the change.

### To set this linker option programmatically

- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.AdditionalOptions%2A>.

## See also

[MSVC linker reference](linking.md)\
[MSVC linker options](linker-options.md)\
[/LINKREPRO](linkrepro.md)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 23 additions & 20 deletions docs/build/reference/overview-of-lib.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: "Overview of LIB"
ms.date: "11/04/2016"
description: Overview of the use and options of the library tool, lib.exe.
ms.date: "09/25/2019"
f1_keywords: ["Lib"]
helpviewer_keywords: ["LIB [C++], modes"]
ms.assetid: e997d423-f574-434f-8b56-25585d137ee0
---
# Overview of LIB

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.
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.

You can use LIB in the following modes:

Expand All @@ -19,29 +20,31 @@ 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
## 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.<br/><br/>For more information see [Building an Import Library and Export File](building-an-import-library-and-export-file.md).|
|**/ERRORREPORT**| Send information to Microsoft about internal errors with lib.exe.<br/><br/>For more information see [Running LIB](running-lib.md).|
|**/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).|
|**/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).|
|**/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).|
|**/LIBPATH**| Overrides the environment library path.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
|**/LIST**| Displays information about the output library to standard output.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
|**/LTCG**| Causes the library to be built using link-time code generation.<br/><br/>For more information see [Running LIB](running-lib.md).|
|**/MACHINE**| Specifies the target platform for the program.<br/><br/>For more information see [Running LIB](running-lib.md).|
|**/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).|
|**/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).|
|**/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).|
|**/OUT**| Overrides the default output filename.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
|**/REMOVE**| Omits an object from the output library.<br/><br/>For more information see [Managing a Library](managing-a-library.md).|
|**/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).|
|**/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).|
|**/WX**| Treat warnings as errors.<br/><br/>For more information see [Running LIB](running-lib.md).|
|**/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).|
|**/ERRORREPORT**| Send information to Microsoft about internal errors with lib.exe.<br/><br/>For more information, see [Running LIB](running-lib.md).|
|**/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).|
|**/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).|
|**/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).|
|**/LIBPATH**| Overrides the environment library path.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
|**/LINKREPRO**| Creates artifacts needed to reproduce a lib.exe crash or internal error.<br/><br/>For more information, see [Running LIB](running-lib.md).|
|**/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).|
|**/LIST**| Displays information about the output library to standard output.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
|**/LTCG**| Causes the library to be built using link-time code generation.<br/><br/>For more information, see [Running LIB](running-lib.md).|
|**/MACHINE**| Specifies the target platform for the program.<br/><br/>For more information, see [Running LIB](running-lib.md).|
|**/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).|
|**/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).|
|**/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).|
|**/OUT**| Overrides the default output filename.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
|**/REMOVE**| Omits an object from the output library.<br/><br/>For more information, see [Managing a Library](managing-a-library.md).|
|**/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).|
|**/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).|
|**/WX**| Treat warnings as errors.<br/><br/>For more information, see [Running LIB](running-lib.md).|

## See also

Expand Down
Loading