1. A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
  2. Why can't I use conio.h functions like clrsrc? Because conio.h is not part of the C standard. It is a Borland extension, and works only with Borland compilers (and perhaps some other commercial compilers). Dev-C uses GCC, the GNU Compiler Collection, as it's compiler.GCC is originally a UNIX compiler, and aims for portability and standards-compliance.
  3. However, importing the same project in Eclipse doesn't go well because I am not able to specify the C compiler and linker options that I get from wx-config. Though I see ABSOLUTELY NO option to just paste all compiler options given by wx-config and all linker options given by the same in Eclipse, I do find Project-Properties-C/C.

Setting up the “Global” Dev C Options Like most IDE there are a number of global options that apply to all projects and then there are project options that only affect the current project. This section aims to assist in setting up the “Global” options. All the screen shots in this document are from Version 4.9.5.0 of Dev C, other.

-->

In the IDE, all information that is needed to build a project is exposed as properties. This information includes the application name, extension (such as DLL, LIB, EXE), compiler options, linker options, debugger settings, custom build steps, and many other things. Typically, you use property pages to view and modify these properties. To access the property pages, choose Project > projectname Properties from the main menu, or right-click on the project node in Solution Explorer and choose Properties.

Default properties

When you create a project, the system assigns values for various properties. The defaults vary somewhat depending on the kind of project and what options you choose in the app wizard. For example, an ATL project has properties related to MIDL files, but these are absent in a basic console application. The default properties are shown in the General pane in the Property Pages:

Applying properties to build configurations and target platforms

Some properties, such as the application name, apply to all build variations, regardless of the target platform or whether it is a debug or release build. But most properties are configuration-dependent. This is because the compiler has to know what specific platform the program will run on and what specific compiler options to use in order to generate the correct code. Therefore, when you set a property, it is important to pay attention to which configuration and platform the new value should apply to. Should it apply only to Debug Win32 builds, or should it also apply to Debug ARM and Debug x64? For example, the Optimization property, by default, is set to Maximize Speed (/O2) in a Release configuration, but is disabled in the Debug configuration.

Dev C Compiler

The property pages are designed so that you can always see, and if necessary modify, which configuration and platform a property value should apply to. The following illustration shows the property pages with the configuration and platform information in the list boxes at the top. When the Optimization property is set here, it will apply only to Debug Win32 builds, which happens to be the active configuration, as shown by the red arrows.

How linkers work

The following illustration shows the same project property page, but the configuration has been changed to Release. Note the different value for the Optimization property. Also note that the active configuration is still Debug. You can set properties for any configuration here; it doesn't have to be the active one.

Target platforms

Target platform refers to the kind of device and/or operating system that the executable will run on. You can build a project for more than one platform. The available target platforms for C++ projects depend on the kind of project; they include but are not limited to Win32, x64, ARM, Android, and iOS. The x86 target platform that you might see in Configuration Manager is identical to Win32 in native C++ projects. Win32 means 32-bit Windows and x64 means 64-bit Windows. For more information about these two platforms, see Running 32-bit applications.

The Any CPU target platform value that you might see in Configuration Manager has no effect on native C++ projects; it is relevant for C++/CLI and other .NET project types. For more information, see /CLRIMAGETYPE (Specify Type of CLR Image).

For more information about setting properties for a Debug build, see:

C++ compiler and linker options

C++ compiler and linker options are located under the C/C++ and Linker nodes in the left pane under Configuration Properties. These translate directly to command-line options that will be passed to the compiler. To read documentation about a specific option, select the option in the center pane and press F1. Or, you can browse documentation for all the options at MSVC Compiler Options and MSVC Linker Options.

The Property Pages dialog box shows only the property pages that are relevant to the current project. For example, if the project does not have an .idl file, the MIDL property page is not displayed. For more information about the setting on each property pages, see Property Pages (C++).

Directory and path values

MSBuild supports the use of compile-time constants called 'macros' for certain string values include directories and paths. These are exposed in the property pages, where you can refer to and modify them by using the Property Editor.

The following illustration shows the property pages for a Visual Studio C++ project. In the left pane, the VC++ Directoriesrule is selected, and the right pane lists the properties that are associated with that rule. The $(..) values are called macros. A macro is a compile-time constant that can refer to a value that is defined by Visual Studio or the MSBuild system, or to a user-defined value. By using macros instead of hard-coded values such as directory paths, you can more easily share property settings between machines and between versions of Visual Studio, and you can better ensure that your project settings participate correctly in property inheritance.

You can use the Property Editor to view the values of all available macros.

Predefined macros

global macros
Applies to all items in a project configuration. Has the syntax $(name). An example of a global macro is $(VCInstallDir), which stores the root directory of your Visual Studio installation. A global macro corresponds to a PropertyGroup in MSBuild.

item macros
Has the syntax %(name). For a file, an item macro applies only to that file—for example, you can use %(AdditionalIncludeDirectories) to specify include directories that apply only to a particular file. This kind of item macro corresponds to an ItemGroup metadata in MSBuild. When it's used in the context of a project configuration, an item macro applies to all files of a certain type. For example, the C/C++ Preprocessor Definitions configuration property can take a %(PreprocessorDefinitions) item macro that applies to all .cpp files in the project. This kind of item macro corresponds to an ItemDefinitionGroup metadata in MSBuild. For more information, see Item Definitions.

User-defined macros

You can create user-defined macros to use as variables in project builds. For example, you could create a user-defined macro that provides a value to a custom build step or a custom build tool. A user-defined macro is a name/value pair. In a project file, use the $(name) notation to access the value.

A user-defined macro is stored in a property sheet. If your project does not already contain a property sheet, you can create one by following the steps under Share or reuse Visual Studio project settings.

To create a user-defined macro

  1. Open the Property Manager window. (On the menu bar, choose View > Property Manager or View > Other Windows > Property Manager.) Open the shortcut menu for a property sheet (its name ends in .user) and then choose Properties. The Property Pages dialog box for that property sheet opens.

  2. In the left pane of the dialog box, select User Macros. In the right pane, choose the Add Macro button to open the Add User Macro dialog box.

  3. Little snitch or similar. In the dialog box, specify a name and value for the macro. Optionally, select the Set this macro as an environment variable in the build environment check box.

Property Editor

You can use the Property Editor to modify certain string properties and select macros as values. To access the Property Editor, select a property on a property page and then choose the down arrow button on the right. If the drop-down list contains <Edit>, then you can choose it to display the Property Editor for that property.

In the Property Editor, you can choose the Macros button to view the available macros and their current values. The following illustration shows the Property Editor for the Additional Include Directories property after the Macros button was chosen. When the Inherit from parent or project defaults check box is selected and you add a new value, it is appended to any values that are currently being inherited. If you clear the check box, your new value replaces the inherited values. In most cases, leave the check box selected.

Add an include directory to the set of default directories

When you add an include directory to a project, it is important not to override all the default directories. The correct way to add a directory is to append the new path, for example 'C:MyNewIncludeDir', and then to Append the $(IncludePath) macro to the property value.

Quickly browse and search all properties

The All Options property page (under the Configuration Properties C/C++ node in the Property Pages dialog box) provides a quick way to browse and search the properties that are available in the current context. It has a special search box and a simple syntax to help you filter results:

No prefix:
Search in property names only (case-insensitive substring).

'/' or '-' :
Search only in compiler switches (case-insensitive prefix)

v:
Search only in values (case-insensitive substring).

Set environment variables for a build

The MSVC compiler (cl.exe) recognizes certain environment variables, specifically LIB, LIBPATH, PATH, and INCLUDE. When you build with the IDE, the properties that are set in the VC++ Directories Property Page property page are used to set those environment variables. If LIB, LIBPATH, and INCLUDE values have already been set, for example by a Developer Command Prompt, they are replaced with the values of the corresponding MSBuild properties. The build then prepends the value of the VC++ Directories executable directories property to PATH. You can set a user-defined environment variable by created a user-defined macro and then checking the box that says Set this macro as an environment variable in the build environment.

Set environment variables for a debugging session

In the left pane of the project's Property Pages dialog box, expand Configuration Properties and then select Debugging.

In the right pane, modify the Environment or Merge Environment project settings and then choose the OK button.

In this section

Share or reuse Visual Studio project settings
How to create a .props file with custom build settings that can be shared or reused.

Project property inheritance
Describes the order of evaluation for the .props, .targets, .vcxproj files and environment variables in the build process.

Modify properties and targets without changing the project file
How to create temporary build settings without having to modify a project file.

See also

Boot camp mac pro 2013. Visual Studio Projects - C++
.vcxproj and .props file structure
Property page XML files

-->

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

What Is A Linker

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

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