Linker Property Pages

The following properties are found under Project > Properties > Configuration Properties > Linker. For more information about the linker, see CL Invokes the Linker and Linker Options.

General Property Page

Output File

The /OUT option overrides the default name and location of the program that the linker creates.

Show Progress

Prints Linker Progress Messages

Choices

  • Not Set - No verbosity.
  • Display all progress messages - Displays all progress messages.
  • For Libraries Searched - Displays progress messages indicating just the libraries searched.
  • About COMDAT folding during optimized linking - Displays information about COMDAT folding during optimized linking.
  • About data removed during optimized linking - Displays information about functions and data removed during optimized linking.
  • About Modules incompatible with SEH - Displays information about modules incompatible with Safe Exception Handling.
  • About linker activity related to managed code - Display information about linker activity related to managed code.

Version

The /VERSION option tells the linker to put a version number in the header of the .exe or .dll file. Use DUMPBIN /HEADERS to see the image version field of the OPTIONAL HEADER VALUES to see the effect of /VERSION.

Enable Incremental Linking

Enables incremental linking. (/INCREMENTAL, /INCREMENTAL:NO)

Suppress Startup Banner

The /NOLOGO option prevents display of the copyright message and version number.

Ignore Import Library

This property tells the linker not to link any .lib output generated from this build into any dependent project. This allows the project system to handle .dll files that do not produce a .lib file when built. If a project depends on another project that produces a DLL, the project system automatically links the .lib file produced by that child project. This may not be needed by projects that are producing COM DLLs or resource-only DLLs; these DLLs do not have any meaningful exports. If a DLL has no exports, the linker does not generate a .lib file. If no export .lib file is present on the disk, and the project system tells the linker to link with this (missing) DLL, the link fails. Use the Ignore Import Library property to resolve this problem. When set to Yes, the project system ignores the presence or absence of that .lib file and causes any project that depends on this project to not link with the nonexistent .lib file.

To programmatically access this property, see IgnoreImportLibrary.

Register Output

Runs regsvr32.exe /s $(TargetPath) on the build output, which is valid only on .dll projects. For .exe projects, this property is ignored. To register an .exe output, set a postbuild event on the configuration to do the custom registration that is always required for registered .exe files.

To programmatically access this property, see RegisterOutput.

Per-user Redirection

Registration in Visual Studio has traditionally been done in HKEY_CLASSES_ROOT (HKCR). With Windows Vista and later operating systems, to access HKCR you must run Visual Studio in elevated mode. Developers do not always want to run in elevated mode but still must work with registration. Per-user redirection allows you to register without having to run in this mode.

Per-user redirection forces any writes to HKCR to be redirected to HKEY_CURRENT_USER (HKCU). If per-user redirection is turned off, it can cause Project Build Error PRJ0050 when the program tries to write to HKCR.

Additional Library Directories

Allows the user to override the environmental library path. (/LIBPATH:folder)

Specifies whether to link the .lib files that are produced by dependent projects. Typically, you want to link in the .lib files, but this may not be the case for certain DLLs.

You can also specify a .obj file by providing the file name and relative path, for example "..\..\MyLibProject\MyObjFile.obj". If the source code for the .obj file #includes a precompiled header, for example pch.h, then the pch.obj file is located in the same folder as MyObjFile.obj, and you must also add pch.obj as an additional dependency.

Use Library Dependency Inputs

Specifies whether or not the inputs to the librarian tool are used rather than the library file itself when linking in library outputs of project dependencies. In a large project, when a dependent project produces a .lib file, incremental linking is disabled. If there are many dependent projects that produce .lib files, building the application can take a long time. When this property is set to Yes, the project system links in the .obj files for .libs produced by dependent projects, thus enabling incremental linking.

For information about how to access the General linker property page, see Set C++ compiler and build properties in Visual Studio.

Specifies whether the linker should display a progress indicator showing what percentage of the link is complete. The default is to not display this status information. (/LTCG:STATUS|LTCG:NOSTATUS)

Prevent Dll Binding

/ALLOWBIND:NO sets a bit in a DLL's header that indicates to Bind.exe that the image is not allowed to be bound. You may not want a DLL to be bound if it has been digitally signed (binding invalidates the signature).

Treat Linker Warning As Errors

/WX causes no output file to be generated if the linker generates a warning.

Force File Output

The /FORCE option tells the linker to create an .exe file or DLL even if a symbol is referenced but not defined or is multiply defined. It may create invalid .exe file.

Choices

  • Enabled - /FORCE with no arguments implies both multiple and unresolved.
  • Multiply Defined Symbol Only - Use /FORCE:MULTIPLE to create an output file whether or not LINK finds more than one definition for a symbol.
  • Undefined Symbol Only - Use /FORCE:UNRESOLVED to create an output file whether or not LINK finds an undefined symbol. /FORCE:UNRESOLVED is ignored if the entry point symbol is unresolved.

Create Hot Patchable Image

Prepares an image for hotpatching.

Choices

  • Enabled - Prepares an image for hotpatching.
  • X86 Image Only - Prepares an X86 image for hotpatching.
  • X64 Image Only - Prepares an X64 image for hotpatching.
  • Itanium Image Only - Prepares an Itanium image for hotpatching.

Specify Section Attributes

The /SECTION option changes the attributes of a section, overriding the attributes set when the .obj file for the section was compiled.

Input Property Page

Additional Dependencies

Specifies additional items to add to the link command line, for example kernel32.lib.

Ignore All Default Libraries

The /NODEFAULTLIB option tells the linker to remove one or more default libraries from the list of libraries it searches when resolving external references.

Ignore Specific Default Libraries

Specifies one or more names of default libraries to ignore; separate multiple libraries with semi-colons. (/NODEFAULTLIB:[name, name, ...])

Module Definition File

The /DEF option passes a module-definition file (.def) to the linker. Only one .def file can be specified to LINK.

Add Module to Assembly

The /ASSEMBLYMODULE option allows you to add a module reference to an assembly. Type information in the module will not be available to the assembly program that added the module reference. However, type information in the module will be available to any program that references the assembly.

Embed Managed Resource File

/ASSEMBLYRESOURCE embeds a resource file in the output file.

Force Symbol References

The /INCLUDE option tells the linker to add a specified symbol to the symbol table.

Delay Loaded Dlls

The /DELAYLOAD option causes delayed loading of DLLs. The dll name specifies a DLL to delay load.

The /ASSEMBLYLINKRESOURCE option creates a link to a .NET Framework resource in the output file; the resource file is not placed in the output file.

Manifest File Property Page

Generate Manifest

/MANIFEST specifies that the linker should create a side-by-side manifest file.

Manifest File

/MANIFESTFILE lets you change the default name of the manifest file. The default name of the manifest file is the file name with .manifest appended.

Additional Manifest Dependencies

/MANIFESTDEPENDENCY lets you specify attributes that will be placed in the dependency section of the manifest file.

Allow Isolation

Specifies behavior for manifest lookup. (/ALLOWISOLATION:NO)

Enable User Account Control (UAC)

Specifies whether or not User Account Control is enabled. (/MANIFESTUAC, /MANIFESTUAC:NO)

UAC Execution Level

Specifies the requested execution level for the application when running with User Account Control. (/MANIFESTUAC:level=[value])

Choices

  • asInvoker - UAC Execution Level: as invoker.
  • highestAvailable - UAC Execution Level: highest available.
  • requireAdministrator - UAC Execution Level: require administrator.

UAC Bypass UI Protection

Specifies whether or not to bypass user interface protection levels for other windows on the desktop. Set this property to 'Yes' only for accessibility applications. (/MANIFESTUAC:uiAccess=[true | false])

Debugging Property Page

Generate Debug Info

This option enables creation of debugging information for the .exe file or the DLL.

Choices

  • No - Produces no debugging information.
  • Generate Debug Information - Create a complete Program Database (PDB) ideal for distribution to Microsoft Symbol Server.
  • Generate Debug Information optimized for faster links - Produces a program database (PDB) ideal for edit-link-debug cycle.
  • Generate Debug Information optimized for sharing and publishing - Produces a program database (PDB) ideal for edit-link-debug cycle.

Generate Program Database File

By default, when /DEBUG is specified, the linker creates a program database (PDB) which holds debugging information. The default file name for the PDB has the base name of the program and the extension .pdb.

Strip Private Symbols

The /PDBSTRIPPED option creates a second program database (PDB) file when you build your program image with any of the compiler or linker options that generate a PDB file (/DEBUG, /Z7, /Zd, or /Zi).

Generate Map File

The /MAP option tells the linker to create a mapfile.

Map File Name

A user-specified name for the mapfile. It replaces the default name.

Map Exports

The /MAPINFO option tells the linker to include the specified information in a mapfile, which is created if you specify the /MAP option. EXPORTS tells the linker to include exported functions.

Debuggable Assembly

/ASSEMBLYDEBUG emits the DebuggableAttribute attribute with debug information tracking and disables JIT optimizations.

System Property Page

SubSystem

The /SUBSYSTEM option tells the operating system how to run the .exe file.The choice of subsystem affects the entry point symbol (or entry point function) that the linker will choose.

Choices

  • Not Set - No subsystem set.
  • Console - Win32 character-mode application. Console applications are given a console by the operating system. If main or wmain is defined, CONSOLE is the default.
  • Windows - Application does not require a console, probably because it creates its own windows for interaction with the user. If WinMain or wWinMain is defined, WINDOWS is the default.
  • Native - Device drivers for Windows NT. If /DRIVER:WDM is specified, NATIVE is the default.
  • EFI Application - EFI Application.
  • EFI Boot Service Driver - EFI Boot Service Driver.
  • EFI ROM - EFI ROM.
  • EFI Runtime - EFI Runtime.
  • POSIX - Application that runs with the POSIX subsystem in Windows NT.

Minimum Required Version

Specify the minimum required version of the subsystem. The arguments are decimal numbers in the range 0 through 65,535.

Heap Reserve Size

Specifies total heap allocation size in virtual memory. Default is 1 MB. (/HEAP:reserve)

Heap Commit Size

Specifies total heap allocation size in physical memory. Default is 4 KB. (/HEAP:reserve,commit)

Stack Reserve Size

Specifies the total stack allocation size in virtual memory. Default is 1 MB. (/STACK:reserve)

Stack Commit Size

Specifies the total stack allocation size in physical memory. Default is 4 KB. (/STACK:reserve,commit)

Enable Large Addresses

The /LARGEADDRESSAWARE option tells the linker that the application can handle addresses larger than 2 gigabytes. By default, /LARGEADDRESSAWARE:NO is enabled if /LARGEADDRESSAWARE is not otherwise specified on the linker line.

Terminal Server

The /TSAWARE option sets a flag in the IMAGE_OPTIONAL_HEADER DllCharacteristics field in the program image's optional header. When this flag is set, Terminal Server will not make certain changes to the application.

Swap Run From CD

The /SWAPRUN option tells the operating system to first copy the linker output to a swap file, and then run the image from there. This is a Windows NT 4.0 (and later) feature. When CD is specified, the operating system will copy the image on a removable disk to a page file and then load it.

Swap Run From Network

The /SWAPRUN option tells the operating system to first copy the linker output to a swap file, and then run the image from there. This is a Windows NT 4.0 (and later) feature. If NET is specified, the operating system will first copy the binary image from the network to a swap file and load it from there. This option is useful for running applications over the network.

Driver

Use the /DRIVER linker option to build a Windows NT kernel mode driver.

Choices

  • Not Set - Default driver setting.
  • Driver - Driver
  • UP Only - /DRIVER:UPONLY causes the linker to add the IMAGE_FILE_UP_SYSTEM_ONLY bit to the characteristics in the output header to specify that it is a uniprocessor (UP) driver. The operating system will refuse to load a UP driver on a multiprocessor (MP) system.
  • WDM - /DRIVER:WDM causes the linker to set the IMAGE_DLLCHARACTERISTICS_WDM_DRIVER bit in the optional header's DllCharacteristics field.

Optimization Property Page

References

/OPT:REF eliminates functions and/or data that are never referenced while /OPT:NOREF keeps functions and/or data that are never referenced.

Enable COMDAT Folding

Use /OPT:ICF[=iterations] to perform identical COMDAT folding.

Function Order

The /ORDERoption tells LINK to optimize your program by placing certain COMDATs into the image in a predetermined order. LINK places the functions in the specified order within each section in the image.

Profile Guided Database

Specify .pgd file for profile guided optimizations. (/PGD)

Specifies link-time code generation. (/LTCG)

Choices

  • Default - Default LTCG setting.
  • Use Fast Link Time Code Generation - Use Link Time Code Generation with /FASTGENPROFILE.
  • Use Link Time Code Generation - Use Link Time Code Generation.
  • Profile Guided Optimization - Instrument - Use profile guided optimization with :PGINSTRUMENT.
  • Profile Guided Optimization - Optimization - Specifies that the linker should use the profile data created after running the instrumented binary to create an optimized image.
  • Profile Guided Optimization - Update - Allows and tracks list of input files to be added or modified from what was specified in the :PGINSTRUMENT phase.

Embedded IDL Property Page

MIDL Commands

Specify MIDL command line Options. (/MIDL:@responsefile)

Ignore Embedded IDL

The /IGNOREIDL option specifies that any IDL attributes in source code should not be processed into an .idl file.

Merged IDL Base File Name

The /IDLOUT option specifies the name and extension of the .idl file.

Type Library

The /TLBOUT option specifies the name and extension of the .tlb file.

TypeLib Resource ID

Allows you to specify the resource ID of the linker-generated type library. (/TLBID:id)

Windows Metadata Property Page

Generate Windows Metadata

Enables or disable generation of Windows Metadata.

Choices

  • Yes - Enable generation of Windows Metadata files.
  • No - Disable the generation of Windows Metadata files.

Windows Metadata File

The /WINMDFILE option switch.

Windows Metadata Key File

Specify key or key pair to sign an Windows Metadata. (/WINMDKEYFILE:filename)

Windows Metadata Key Container

Specify a key container to sign an Windows Metadata. (/WINMDKEYCONTAINER:name)

Windows Metadata Delay Sign

Partially sign an Windows Metadata. Use /WINMDDELAYSIGN if you only want to place the public key in the Windows Metadata. The default is /WINMDDELAYSIGN:NO.

Advanced Property Page

Entry Point

The /ENTRY option specifies an entry point function as the starting address for an .exe file or DLL.

No Entry Point

The /NOENTRYoption is required for creating a resource-only DLL.Use this option to prevent LINK from linking a reference to _main into the DLL.

Set Checksum

The /RELEASE option sets the Checksum in the header of an .exe file.

Base Address

Sets a base address for the program. (/BASE:{address[,size] | @filename,key})

Randomized Base Address

Randomized Base Address. (/DYNAMICBASE[:NO])

Fixed Base Address

Creates a program that can be loaded only at its preferred base address. (/FIXED[:NO])

Data Execution Prevention (DEP)

Marks an executable as having been tested to be compatible with Windows Data Execution Prevention feature. (/NXCOMPAT[:NO])

Turn Off Assembly Generation

The /NOASSEMBLY option tells the linker to create an image for the current output file without a .NET Framework assembly.

Unload delay loaded DLL

The UNLOAD qualifier tells the delay-load helper function to support explicit unloading of the DLL. (/DELAY:UNLOAD)

Nobind delay loaded DLL

The NOBIND qualifier tells the linker not to include a bindable IAT in the final image. The default is to create the bindable IAT for delay-loaded DLLs. (/DELAY:NOBIND)

Import Library

Overrides the default import library name. (/IMPLIB:filename)

Merge Sections

The /MERGE option combines the first section (from) with the second section (to), naming the resulting section to. For example, /merge:.rdata=.text.

Target Machine

The /MACHINE option specifies the target platform for the program.

Choices

  • Not Set
  • MachineARM
  • MachineARM64
  • MachineEBC
  • MachineIA64
  • MachineMIPS
  • MachineMIPS16
  • MachineMIPSFPU
  • MachineMIPSFPU16
  • MachineSH4
  • MachineTHUMB
  • MachineX64
  • MachineX86

Profile

Produces an output file that can be used with the Performance Tools profiler. Requires GenerateDebugInformation (//DEBUG) to be set. (/PROFILE)

CLR Thread Attribute

Explicitly specify the threading attribute for the entry point of your CLR program.

Choices

  • MTA threading attribute - Applies the MTAThreadAttribute attribute to the entry point of your program.
  • STA threading attribute - Applies the STAThreadAttribute attribute to the entry point of your program.
  • Default threading attribute - Same as not specifying /CLRTHREADATTRIBUTE. Lets the Common Language Runtime (CLR) set the default threading attribute.

CLR Image Type

Sets the type (IJW, pure, or safe) of a CLR image.

Choices

  • Force IJW image
  • Force Pure IL Image
  • Force Safe IL Image
  • Default image type

Key File

Specify key or key pair to sign an assembly. (/KEYFILE:filename)

Key Container

Specify a key container to sign an assembly. (/KEYCONTAINER:name)

Delay Sign

Partially sign an assembly. Use /DELAYSIGN if you only want to place the public key in the assembly. The default is /DELAYSIGN:NO.

CLR Unmanaged Code Check

/CLRUNMANAGEDCODECHECK specifies whether the linker will apply SuppressUnmanagedCodeSecurityAttribute to linker-generated PInvoke calls from managed code into native DLLs.

Error Reporting

Allows you to provide internal compiler error (ICE) information directly to the Visual C++ team.

Choices

  • PromptImmediately - Prompt immediately.
  • Queue For Next Login - Queue for next login.
  • Send Error Report - Send error report.
  • No Error Report - No error report.

SectionAlignment

The /ALIGN option specifies the alignment of each section within the linear address space of the program. The number argument is in bytes and must be a power of two.

Preserve Last Error Code for PInvoke Calls

/CLRSUPPORTLASTERROR, which is on by default, preserves the last error code of functions called through the P/Invoke mechanism, which allows you to call native functions in DLLS, from code compiled with /clr.

Choices

  • Enabled - Enable CLRSupportLastError.
  • Disabled - Disable CLRSupportLastError.
  • System Dlls Only - Enable CLRSupportLastError for system dlls only.

Image Has Safe Exception Handlers

When /SAFESEH is specified, the linker will only produce an image if it can also produce a table of the image's safe exception handlers. This table specifies for the operating system which exception handlers are valid for the image.