Linker Options and Related Information

You can set Linker options from:

The following table describes the Linker options.

Linker Option Function
/ALIGN Specifies the alignment of each section within the linear address space of the program.
/BASE Sets a base address for the program, overriding the default location.
/COMMENT Inserts a comment string into the header of an executable file or DLL, after the array of section headers.
/DEBUG Creates debugging information for the executable file or DLL.
/DEBUGTYPE Generates debugging information in one of three ways: Microsoft format (CV), COFF format, or both.
/DEF Passes a module-definition (.DEF) file to the linker.
/DEFAULTLIB Adds one or more libraries to the list of libraries that LINK searches when resolving references.
/DELAY Controls the delayed loading of DDLs.
/DELAYLOAD Causes delayed loading of DLLs.
/DLL Builds a DLL as the main output file when using the command line.
/DRIVER Used to build a Windows NT 4 or Windows 2000 kernel mode driver.
/ENTRY Sets the starting address for an executable file or DLL.
/EXETYPE Used when building a virtual device driver (requested by using the /VXD option).
/EXPORT Exports a function from your program.
/FIXED Tells the operating system to load the program only at its preferred base address.
/FORCE Informs the linker to create a valid executable file or DLL even if a symbol is referenced but not defined or is multiply defined.
/HEAP Sets the size of the heap in bytes.
/IMPLIB Sets the name for the import library that LINK creates when it builds a program that contains exports.
/IMPORT Does not apply to Visual Fortran.
/INCLUDE Informs the linker to add a specified symbol to the symbol table.
/INCREMENTAL Controls how the linker handles incremental linking.
/LARGEADDRESSAWARE Informs the linker that the application can handle addresses larger than 2 gigabytes.
/LIBPATH Overrides the environment library path.
/LINK50COMPAT Generates import libraries in the old (Visual C++ version 5.0) format for backward compatibility.
/MACHINE Specifies the target platform for the program.
/MAP Informs the linker to generate a mapfile. You can also specify the file name.
/MAPINFO Informs the linker to include the specified information in a map file (requested by /MAP).
/MERGE Combines the first section with the second section and names the resulting section.
/NODEFAULTLIB Informs the linker to remove all default libraries from the list of libraries it searches when resolving external references. If you specify one or more libraries, the linker only ignores the libraries you have named.
/NOENTRY Prevents LINK from linking a reference to _main into the DLL.
/NOLOGO Prevents the display of the copyright message and version number. It also suppresses echoing of command files.
/OPT Controls the optimizations LINK performs during a build.
/ORDER Lets you perform optimization by telling LINK to place certain packaged functions into the image in a predetermined order.
/OUT Overrides the default name and location of the image file that LINK creates.
/PDB Controls how the linker produces debugging information.
/PDBTYPE Controls which Program Database (PDB) is used to store the debug type information.
/PROFILE Creates an output file that can be used with the profiler.
/RELEASE Sets the checksum in the header of an executable file.
/SECTION Changes the attributes of a section, overriding the attributes set when the .OBJ file for the section was compiled.
/STACK Sets the size of the stack in bytes.
/STUB Attaches an MS-DOS stub program to a Win32 program.
/SUBSYSTEM Tells the operating system how to run the executable file.
/SWAPRUN Informs the operating system to first copy the linker output to a swap file, and then run the image from there (Windows NT 4 or Windows 2000).
/VERBOSE Sends information about the progress of the linking session to the Output window.
/VERSION Informs the linker to put a version number in the header of the executable file or DLL.
/VXD Creates a virtual device driver (VxD).
/WARN Determines the output of LINK warnings.
/WS Adds the WS_AGGRESSIVE attribute to your application's image.

This table lists the Linker options with the equivalent Microsoft visual development environment category if one is available. Options not listed are usually command-line only and can be entered in the "Common Options" text box of the Project ... Settings dialog box. For instructions on how to work with the Microsoft visual development environment, see Building Programs and Libraries.

Linker Option Visual Development Environment Category
/ALIGN Command-line only
/BASE Output Category
/DEBUG Debug Category
/DEBUGTYPE Debug Category
/DEF Command-line only
/DEFAULTLIB Command-line only
/ENTRY Output Category
/FORCE Customize Category
/INCLUDE Input Category
/INCREMENTAL Customize Category
/LIBPATH Input Category
/MAP Debug Category
/NODEFAULTLIB Input Category
/NOLOGO Customize Category
/OUT Customize Category
/PDB Customize Category
/PDBTYPE Debug Category
/PROFILE General Category
/STACK Output Category
/VERBOSE Customize Category
/VERSION Output Category

Besides discussing linker options individually, this section also discusses Module-Definition Files and Linker Reserved Words.