Partilhar via


Project Settings for a C++ Debug Configuration

You can change the project settings for a C or Visual C++ debug configuration in the Property Pages dialog box, as discussed in How to: Set Debug and Release Configurations. The following tables show where to find debugger-related settings in the Property Pages dialog box.

Warning

The debug project settings in the Configuration Properties/Debugging category for Windows Store apps and components that are written in C++ are different. See Start a debugging session for a Store app in Visual Studio (VB, C#, C++ and XAML) in the Windows Development Center.

Specify which debugger to use in the Debugger to launch list box. Your choice will affect which properties are visible.

Each debug property setting is automatically written and saved to the "per-user" file (.vcxproj.user) for your solution whenever you save your solution.

Configuration Properties folder (Debugging category)

Setting

Description

Debugger to launch

Specifies the debugger to run, with the following choices:

  • Local Windows Debugger

  • Remote Windows Debugger

  • Web Browser Debugger

  • Web Service Debugger

Command (Local Windows Debugger)

Specifies the command for starting the program that you are debugging on the local computer.

Remote Command (Remote Windows Debugger)

The path for the .exe on the remote computer. Enter the path just as you would enter it on the remote machine.

Command Arguments (Local Windows Debugger and Remote Windows Debugger)

  • Specifies arguments for the command specified earlier.

You can use the following redirection operators in this box:

< file

Reads stdin from file.

> file

Writes stdout to file.

>> file

Appends stdout to file.

2> file

Writes stderr to file.

2>> file

Appends stderr to file.

2> &1

Sends stderr (2) output to same location as stdout (1).

1> &2

Sends stdout (1) output to same location as stderr (2).

In most cases, these operators are applicable only to console applications.

Working Directory

Specifies the working directory of the program being debugged, relative to the project directory where your EXE is located. If you leave this blank, the working directory is the project directory. For remote debugging, the project directory will be on the remote server.

Attach (Local Windows Debugger and Remote Windows Debugger)

Specifies whether to start or attach to the application. Default setting is No.

Remote Server Name (Remote Windows Debugger)

Specifies the name of a computer (other than yours) on which you want to debug an application.

The RemoteMachine Build macro is set to the value of this property; for more information, see Macros for Build Commands and Properties.

Connection (Remote Windows Debugger)

Allows you to switch between standard and no-authentication connection types for remote debugging. Specify a remote computer name in the Remote Server Name box. Connection types include the following:

  • Remote with Windows Authentication

  • Remote with No Authentication (Native Only)

Note   Remote debugging with No Authentication may leave the remote computer vulnerable to security violations. Windows Authentication mode is more secure.

For more information, see Remote Debugging Setup.

HTTP URL (Web Service Debugger and Web Browser Debugger)

Specifies the URL where the project you are debugging is located.

Debugger Type

Specifies the type of debugger to be used: Native Only, Managed Only, GPU Only, Mixed, Auto (default), or Script.

  • Native Only is for unmanaged C++ code.

  • Managed Only is for code that runs under the common language runtime (managed code).

  • Mixed invokes debuggers for both managed and unmanaged code.

  • Auto determines the debugger type based on compiler and EXE information.

  • Script invokes a debugger for scripts.

  • GPU Only is for C++ AMP code that runs on a GPU device or on the DirectX reference rasterizer. See Debugging GPU Code.

Environment (Local Windows Debugger)

Specifies environment variables for the program that you are debugging. Use standard environment variable syntax (for example, PATH="%SystemRoot%\..."). These variables override the system environment or are merged with the system environment, depending on the Merge Environment setting. When you click in the settings column, an "Edit…" appears. Click that link to edit environment variables.

Merge Environment (Local Windows Debugger)

Determines whether the variables that are specified in the Environment box will be merged with the environment that is defined by the operating system. Default setting is Yes.

SQL Debugging (all but MPI Cluster Debugger)

Enables debugging of SQL procedures from your Visual C++ application. Default setting is No.

Debugging Accelerator Type (GPU debugging only)

Specifies the GPU device to use for debugging. Installing device drivers for compatible GPU devices will add additional options. The default setting is "GPU - Software Emulator."

GPU Default Breakpoint Behavior (GPU debugging only)

Specifies whether a breakpoint event should be raised for each thread in a SIMD warp. The default setting is to raise the breakpoint event only once per warp.

Amp Default Accelerator (GPU debugging only)

Specifies the default AMP accelerator when debugging GPU code. Choose WARP software accelerator to investigate if an issue is caused by the hardware or a driver instead of your code.

Deployment Directory (Remote Windows Debugger)

Specifies the path on the remote computer where the project output will be copied prior to launch. The path can be a network share on the remote computer, or it can be a path to a folder on the remote computer. The default setting is empty, which means the project output is not copied to a network share. To enable deployment of the files, you must also select the Deploy check box in the Configuration Manager dialog box. For more information, see How to: Create and Edit Configurations.

Additional Files to Deploy (Remote Windows Debugger)

If the Deployment Directory property is set, this is a semi-colon delimited list of additional files to copy to the deployment directory. The default setting is empty, which means that no additional files are copied to the deployment directory. To enable deployment of the files, you must also select the Deploy check box in the Configuration Manager dialog box. For more information, see How to: Create and Edit Configurations.

Deploy Visual C++ Debug Runtime Libraries (Remote Windows Debugger)

If the Deployment Directory property is set, this specifies whether the Visual C++ debug runtime libraries for the current platform should be copied to the network share. The default setting is Yes.

C/C++ folder (General category)

Setting

Description

Debug Information Format (/Z7, /Zd, Zi, /ZI)

Specifies the type of debug information to be created for the project.

The default option (/ZI) creates a program database (PDB) in Edit and Continue compatible format. For more information, see /Z7, /Zd, /Zi, /ZI (Debug Information Format).

C/C++ folder (Optimization category)

Setting

Description

Optimization

Specifies whether the compiler should optimize the code it produces. Optimization changes the code that is executed. Optimized code no longer matches the source code. Therefore, debugging is difficult.

The default option (Disabled (/0d) suppresses optimization. You can develop with optimization suppressed, and then turn it on when you create the production version of your code.

Linker folder (Debugging category)

Setting

Description

Generate Debug Info (/DEBUG)

Tells the linker to include debug information, which will have the format specified by /Z7, /Zd, Zi, or /ZI.

Generate Program Database File (/PDB:name)

Specify the name of a PDB file in this box. You must select ZI or /Zi for Debug Information Format.

Strip Private Symbols (/PDBSTRIPPED:filename)

Specify the name of a PDB file in this box if you do not want to include private symbols in the PDB file. This 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, such as /DEBUG, /Z7, /Zd. Or /Zi. This second PDB file omits symbols that you would not want to ship to your customers. For more information, see /PDBSTRIPPED (Strip Private Symbols).

Generate Map File (/MAP)

Tells the linker to generate a map file during linking. Default setting is No. For more information, see /MAP (Generate Mapfile).

Map File Name(/MAP:name)

If you choose Generate Map File, you can specify the map file in this box. For more information, see /MAP (Generate Mapfile).

Map Exports (/MAPINFO:EXPORTS)

Includes exported functions in the map file. Default setting is No. For more information, see /MAPINFO (Include Information in Mapfile).

Debuggable Assembly (/ASSEMBLYDEBUG)

Specifies settings for the Linker /ASSEMBLYDEBUG option. Possible values are as follows:

  • No debuggable attribute emitted.

  • Runtime tracking and disable optimizations (/ASSEMBLYDEBUG). This is the default setting,

  • No runtime tracking and enable optimizations(/ASSEMBLYDEBUG:DISABLE).

  • <inherit from parent or project defaults>.

  • For more information, see /ASSEMBLYDEBUG (Add DebuggableAttribute).

You can change these settings in the Configuration Properties folder (Debug category) programmatically by using the Microsoft.VisualStudio.VCProjectEngine.VCDebugSettings interface. For more information, see VCDebugSettings.

See Also

Reference

/ASSEMBLYDEBUG (Add DebuggableAttribute)

Other Resources

Debugging Native Code

Debug Settings and Preparation

Creating and Managing Visual C++ Projects

Macros for Build Commands and Properties