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.
-->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.
Linker options listed alphabetically
Option | Purpose |
---|---|
@ | Specifies a response file. |
/ALIGN | Specifies the alignment of each section. |
/ALLOWBIND | Specifies that a DLL can't be bound. |
/ALLOWISOLATION | Specifies behavior for manifest lookup. |
/APPCONTAINER | Specifies whether the app must run within an appcontainer process environment. |
/ASSEMBLYDEBUG | Adds the DebuggableAttribute to a managed image. |
/ASSEMBLYLINKRESOURCE | Creates a link to a managed resource. |
/ASSEMBLYMODULE | Specifies that a Microsoft intermediate language (MSIL) module should be imported into the assembly. |
/ASSEMBLYRESOURCE | Embeds a managed resource file in an assembly. |
/BASE | Sets a base address for the program. |
/CGTHREADS | Sets number of cl.exe threads to use for optimization and code generation when link-time code generation is specified. |
/CLRIMAGETYPE | Sets the type (IJW, pure, or safe) of a CLR image. |
/CLRSUPPORTLASTERROR | Preserves the last error code of functions that are called through the P/Invoke mechanism. |
/CLRTHREADATTRIBUTE | Specifies the threading attribute to apply to the entry point of your CLR program. |
/CLRUNMANAGEDCODECHECK | Specifies whether the linker will apply the SuppressUnmanagedCodeSecurity attribute to linker-generated PInvoke stubs that call from managed code into native DLLs. |
/DEBUG | Creates debugging information. |
/DEBUGTYPE | Specifies which data to include in debugging information. |
/DEF | Passes a module-definition (.def) file to the linker. |
/DEFAULTLIB | Searches the specified library when external references are resolved. |
/DELAY | Controls the delayed loading of DLLs. |
/DELAYLOAD | Causes the delayed loading of the specified DLL. |
/DELAYSIGN | Partially signs an assembly. |
/DEPENDENTLOADFLAG | Sets default flags on dependent DLL loads. |
/DLL | Builds a DLL. |
/DRIVER | Creates a kernel mode driver. |
/DYNAMICBASE | Specifies whether to generate an executable image that's rebased at load time by using the address space layout randomization (ASLR) feature. |
/ENTRY | Sets the starting address. |
/ERRORREPORT | Deprecated. Error reporting is controlled by Windows Error Reporting (WER) settings. |
/EXPORT | Exports a function. |
/FILEALIGN | Aligns sections within the output file on multiples of a specified value. |
/FIXED | Creates a program that can be loaded only at its preferred base address. |
/FORCE | Forces a link to complete even with unresolved symbols or symbols defined more than once. |
/FUNCTIONPADMIN | Creates an image that can be hot patched. |
/GENPROFILE, /FASTGENPROFILE | Both 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. |
/GUARD | Enables Control Flow Guard protection. |
/HEAP | Sets the size of the heap, in bytes. |
/HIGHENTROPYVA | Specifies support for high-entropy 64-bit address space layout randomization (ASLR). |
/IDLOUT | Specifies the name of the .idl file and other MIDL output files. |
/IGNORE | Suppresses output of specified linker warnings. |
/IGNOREIDL | Prevents the processing of attribute information into an .idl file. |
/IMPLIB | Overrides the default import library name. |
/INCLUDE | Forces symbol references. |
/INCREMENTAL | Controls incremental linking. |
/INTEGRITYCHECK | Specifies that the module requires a signature check at load time. |
/KEYCONTAINER | Specifies a key container to sign an assembly. |
/KEYFILE | Specifies a key or key pair to sign an assembly. |
/LARGEADDRESSAWARE | Tells the compiler that the application supports addresses larger than two gigabytes |
/LIBPATH | Specifies a path to search before the environmental library path. |
/LINKREPRO | Specifies a path to generate link repro artifacts in. |
/LINKREPROTARGET | Generates a link repro only when producing the specified target.16.1 |
/LTCG | Specifies link-time code generation. |
/MACHINE | Specifies the target platform. |
/MANIFEST | Creates a side-by-side manifest file and optionally embeds it in the binary. |
/MANIFESTDEPENDENCY | Specifies a <dependentAssembly> section in the manifest file. |
/MANIFESTFILE | Changes the default name of the manifest file. |
/MANIFESTINPUT | Specifies 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. |
/MANIFESTUAC | Specifies whether User Account Control (UAC) information is embedded in the program manifest. |
/MAP | Creates a mapfile. |
/MAPINFO | Includes the specified information in the mapfile. |
/MERGE | Combines sections. |
/MIDL | Specifies MIDL command-line options. |
/NATVIS | Adds debugger visualizers from a Natvis file to the program database (PDB). |
/NOASSEMBLY | Suppresses the creation of a .NET Framework assembly. |
/NODEFAULTLIB | Ignores all (or the specified) default libraries when external references are resolved. |
/NOENTRY | Creates a resource-only DLL. |
/NOLOGO | Suppresses the startup banner. |
/NXCOMPAT | Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. |
/OPT | Controls LINK optimizations. |
/ORDER | Places COMDATs into the image in a predetermined order. |
/OUT | Specifies the output file name. |
/PDB | Creates a PDB file. |
/PDBALTPATH | Uses an alternate location to save a PDB file. |
/PDBSTRIPPED | Creates a PDB file that has no private symbols. |
/PGD | Specifies a .pgd file for profile-guided optimizations. |
/POGOSAFEMODE | Obsolete Creates a thread-safe PGO instrumented build. |
/PROFILE | Produces an output file that can be used with the Performance Tools profiler. |
/RELEASE | Sets the Checksum in the .exe header. |
/SAFESEH | Specifies that the image will contain a table of safe exception handlers. |
/SECTION | Overrides the attributes of a section. |
/SOURCELINK | Specifies a SourceLink file to add to the PDB. |
/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 .exe file. |
/SWAPRUN | Tells the operating system to copy the linker output to a swap file before it's run. |
/TLBID | Specifies the resource ID of the linker-generated type library. |
/TLBOUT | Specifies the name of the .tlb file and other MIDL output files. |
/TSAWARE | Creates an application that is designed specifically to run under Terminal Server. |
/USEPROFILE | Uses profile-guided optimization training data to create an optimized image. |
/VERBOSE | Prints linker progress messages. |
/VERSION | Assigns a version number. |
/WHOLEARCHIVE | Includes every object file from specified static libraries. |
/WINMD | Enables generation of a Windows Runtime Metadata file. |
/WINMDFILE | Specifies the file name for the Windows Runtime Metadata (winmd) output file that's generated by the /WINMD linker option. |
/WINMDKEYFILE | Specifies a key or key pair to sign a Windows Runtime Metadata file. |
/WINMDKEYCONTAINER | Specifies a key container to sign a Windows Metadata file. |
/WINMDDELAYSIGN | Partially signs a Windows Runtime Metadata (.winmd) file by placing the public key in the winmd file. |
/WX | Treats 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
The %LIBPATH% environment variable specifies the default path to search for .winmd files.
Compiler options
Option | Description |
---|---|
/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. |
/AIdir | Adds a directory, which is specified by the dir parameter, to the search path that the compiler uses to find assembly and .winmd files. |
/FUfile | Forces the inclusion of the specified module, or .winmd file. That is, you don't have to specify #using file 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
Option | Description |
---|---|
/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:filename | The 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:name | Specifies a key container to sign an assembly. The name parameter corresponds to the key container that's used to sign the metadata file. |
/WINMDKEYFILE:filename | Specifies 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.