Linker Options In Dev C++

Mar 06, 2018  The instructions here are as per version 4.9.9.2 of Dev C. I don’t think there will be much changes in any older version. So here we go: 1. Go to the Tools menu. In the Tools menu, you should find and option called Compiler Options.

-->Dev

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

The following table lists options for LINK.exe. For more information about LINK, see:

On the command line, linker options aren't case-sensitive; for example, /base and /BASE mean the same thing. For details on how to specify each option on the command line or in Visual Studio, see the documentation for that option.

You can use the comment pragma to specify some linker options.

Dev

Linker options listed alphabetically

OptionPurpose
@Specifies a response file.
/ALIGNSpecifies the alignment of each section.
/ALLOWBINDSpecifies that a DLL can't be bound.
/ALLOWISOLATIONSpecifies behavior for manifest lookup.
/APPCONTAINERSpecifies whether the app must run within an appcontainer process environment.
/ASSEMBLYDEBUGAdds the DebuggableAttribute to a managed image.
/ASSEMBLYLINKRESOURCECreates a link to a managed resource.
/ASSEMBLYMODULESpecifies that a Microsoft intermediate language (MSIL) module should be imported into the assembly.
/ASSEMBLYRESOURCEEmbeds a managed resource file in an assembly.
/BASESets a base address for the program.
/CGTHREADSSets number of cl.exe threads to use for optimization and code generation when link-time code generation is specified.
/CLRIMAGETYPESets the type (IJW, pure, or safe) of a CLR image.
/CLRSUPPORTLASTERRORPreserves the last error code of functions that are called through the P/Invoke mechanism.
/CLRTHREADATTRIBUTESpecifies the threading attribute to apply to the entry point of your CLR program.
/CLRUNMANAGEDCODECHECKSpecifies whether the linker will apply the SuppressUnmanagedCodeSecurity attribute to linker-generated PInvoke stubs that call from managed code into native DLLs.
/DEBUGCreates debugging information.
/DEBUGTYPESpecifies which data to include in debugging information.
/DEFPasses a module-definition (.def) file to the linker.
/DEFAULTLIBSearches the specified library when external references are resolved.
/DELAYControls the delayed loading of DLLs.
/DELAYLOADCauses the delayed loading of the specified DLL.
/DELAYSIGNPartially signs an assembly.
/DEPENDENTLOADFLAGSets default flags on dependent DLL loads.
/DLLBuilds a DLL.
/DRIVERCreates a kernel mode driver.
/DYNAMICBASESpecifies whether to generate an executable image that's rebased at load time by using the address space layout randomization (ASLR) feature.
/ENTRYSets the starting address.
/ERRORREPORTDeprecated. Error reporting is controlled by Windows Error Reporting (WER) settings.
/EXPORTExports a function.
/FILEALIGNAligns sections within the output file on multiples of a specified value.
/FIXEDCreates a program that can be loaded only at its preferred base address.
/FORCEForces a link to complete even with unresolved symbols or symbols defined more than once.
/FUNCTIONPADMINCreates an image that can be hot patched.
/GENPROFILE, /FASTGENPROFILEBoth of these options specify generation of a .pgd file by the linker to support profile-guided optimization (PGO). /GENPROFILE and /FASTGENPROFILE use different default parameters.
/GUARDEnables Control Flow Guard protection.
/HEAPSets the size of the heap, in bytes.
/HIGHENTROPYVASpecifies support for high-entropy 64-bit address space layout randomization (ASLR).
/IDLOUTSpecifies the name of the .idl file and other MIDL output files.
/IGNORESuppresses output of specified linker warnings.
/IGNOREIDLPrevents the processing of attribute information into an .idl file.
/IMPLIBOverrides the default import library name.
/INCLUDEForces symbol references.
/INCREMENTALControls incremental linking.
/INTEGRITYCHECKSpecifies that the module requires a signature check at load time.
/KEYCONTAINERSpecifies a key container to sign an assembly.
/KEYFILESpecifies a key or key pair to sign an assembly.
/LARGEADDRESSAWARETells the compiler that the application supports addresses larger than two gigabytes
/LIBPATHSpecifies a path to search before the environmental library path.
/LINKREPROSpecifies a path to generate link repro artifacts in.
/LINKREPROTARGETGenerates a link repro only when producing the specified target.16.1
/LTCGSpecifies link-time code generation.
/MACHINESpecifies the target platform.
/MANIFESTCreates a side-by-side manifest file and optionally embeds it in the binary.
/MANIFESTDEPENDENCYSpecifies a <dependentAssembly> section in the manifest file.
/MANIFESTFILEChanges the default name of the manifest file.
/MANIFESTINPUTSpecifies a manifest input file for the linker to process and embed in the binary. You can use this option multiple times to specify more than one manifest input file.
/MANIFESTUACSpecifies whether User Account Control (UAC) information is embedded in the program manifest.
/MAPCreates a mapfile.
/MAPINFOIncludes the specified information in the mapfile.
/MERGECombines sections.
/MIDLSpecifies MIDL command-line options.
/NATVISAdds debugger visualizers from a Natvis file to the program database (PDB).
/NOASSEMBLYSuppresses the creation of a .NET Framework assembly.
/NODEFAULTLIBIgnores all (or the specified) default libraries when external references are resolved.
/NOENTRYCreates a resource-only DLL.
/NOLOGOSuppresses the startup banner.
/NXCOMPATMarks an executable as verified to be compatible with the Windows Data Execution Prevention feature.
/OPTControls LINK optimizations.
/ORDERPlaces COMDATs into the image in a predetermined order.
/OUTSpecifies the output file name.
/PDBCreates a PDB file.
/PDBALTPATHUses an alternate location to save a PDB file.
/PDBSTRIPPEDCreates a PDB file that has no private symbols.
/PGDSpecifies a .pgd file for profile-guided optimizations.
/POGOSAFEMODEObsolete Creates a thread-safe PGO instrumented build.
/PROFILEProduces an output file that can be used with the Performance Tools profiler.
/RELEASESets the Checksum in the .exe header.
/SAFESEHSpecifies that the image will contain a table of safe exception handlers.
/SECTIONOverrides the attributes of a section.
/SOURCELINKSpecifies a SourceLink file to add to the PDB.
/STACKSets the size of the stack in bytes.
/STUBAttaches an MS-DOS stub program to a Win32 program.
/SUBSYSTEMTells the operating system how to run the .exe file.
/SWAPRUNTells the operating system to copy the linker output to a swap file before it's run.
/TLBIDSpecifies the resource ID of the linker-generated type library.
/TLBOUTSpecifies the name of the .tlb file and other MIDL output files.
/TSAWARECreates an application that is designed specifically to run under Terminal Server.
/USEPROFILEUses profile-guided optimization training data to create an optimized image.
/VERBOSEPrints linker progress messages.
/VERSIONAssigns a version number.
/WHOLEARCHIVEIncludes every object file from specified static libraries.
/WINMDEnables generation of a Windows Runtime Metadata file.
/WINMDFILESpecifies the file name for the Windows Runtime Metadata (winmd) output file that's generated by the /WINMD linker option.
/WINMDKEYFILESpecifies a key or key pair to sign a Windows Runtime Metadata file.
/WINMDKEYCONTAINERSpecifies a key container to sign a Windows Metadata file.
/WINMDDELAYSIGNPartially signs a Windows Runtime Metadata (.winmd) file by placing the public key in the winmd file.
/WXTreats linker warnings as errors.

16.1 This option is available starting in Visual Studio 2019 version 16.1.

See also

C/C++ Building Reference
MSVC linker reference

-->

An environment variable, C++/CX compiler options, and linker options support the building of apps for the Windows Runtime.

Library path

Options

The %LIBPATH% environment variable specifies the default path to search for .winmd files.

Compiler options

OptionDescription
/ZW
/ZW:nostdlib
Enables Windows Runtime language extensions.
The nostdlib parameter prevents the compiler from using the standard, predefined search path to find assembly and .winmd files.
The /ZW compiler option implicitly specifies the following compiler options:
- /FI vccorlib.h, which forces inclusion of the vccorlib.h header file that defines many types that are required by the compiler.
- /FU Windows.winmd, which forces inclusion of the Windows.winmd metadata file that's provided by the operating system and defines many types in the Windows Runtime.
- /FU Platform.winmd, which forces inclusion of the Platform.winmd metadata file that's provided by the compiler and defines most types in the Platform family of namespaces.
/AIdirAdds a directory, which is specified by the dir parameter, to the search path that the compiler uses to find assembly and .winmd files.
/FUfileForces the inclusion of the specified module, or .winmd file. That is, you don't have to specify #usingfile in your source code. The compiler automatically forces the inclusion of its own Windows metadata file, Platform.winmd.
/D 'WINAPI_FAMILY=2'Creates a definition that enables the use of a subset of the Win32 SDK that's compatible with the Windows Runtime.

Linker options

OptionDescription
/APPCONTAINER[:NO]Marks the executable as runnable in the appcontainer (only).
/WINMD[:{NO|ONLY}]Emits a .winmd file and an associated binary file. This option must be passed to the linker for a .winmd to be emitted.
NO—Doesn't emit a .winmd file, but does emit a binary file.
ONLY—Emits a .winmd file, but doesn't emit a binary file.
/WINMDFILE:filenameThe name of the .winmd file to emit, instead of the default .winmd file name. If multiple file names are specified on the command line, the last name is used.
/WINMDDELAYSIGN[:NO]Partially signs the .winmd file and places the public key in the binary.
NO—(Default) Doesn't sign the .winmd file.
/WINMDDELAYSIGN has no effect unless /WINMDKEYFILE or /WINMDKEYCONTAINER is also specified.
/WINMDKEYCONTAINER:nameSpecifies a key container to sign an assembly. The name parameter corresponds to the key container that's used to sign the metadata file.
/WINMDKEYFILE:filenameSpecifies a key or a key pair to sign the assembly. The filename parameter corresponds to the key that's used to sign the metadata file.

Linker Options In Dev C Pdf

Remarks

Dev C Compiler

When you use /ZW, the compiler automatically links to the DLL version of the C Runtime (CRT). Linking to the static library version is not allowed, and any use of CRT functions that are not allowed in a Universal Windows Platform app will cause a compile-time error.

C++ Linker Error Undefined Reference

See also