Partilhar via


Project Settings for a C++ Debug Configuration 

You can change the project settings for a C or 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.

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 (.suo) for your solution whenever you save your solution.

Configuration Properties folder (Debugging category)

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 Service Debugger

  • MPI Cluster Debugger

Command (Local Windows Debugger)

Specifies the command for launching the program you are debugging on the local machine.

Remote Command (Remote Windows Debugger)

Application Command (MPI Cluster Debugger)

The pathname for the .exe as seen by the remote machine.

Command Arguments (Local Windows Debugger and Remote Windows Debugger)

Application Arguments (MPI Cluster Debugger)

  • Specifies arguments for the command specified above.

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 launch or attach to the application. Default setting is No.

Remote Server Name (Remote Windows Debugger and MPI Cluster Debugger)

Specifies the name of a computer (other than yours) on which you want to debug an application or an Msvsmon server name. You can also select this from the Processes dialog box (for more information, see Selecting a Remote Machine). If you specify the machine name here, you must also specify the connection type in Connection.

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 and MPI Cluster Debugger)

Allows you to switch between local and remote debugging. Specify a remote machine name in the Remote Server Name box. Connection types include:

  • Remote with Windows Authentication

  • Remote with No Authentication (Native Only)

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

For more information, see Remote Debugging Setup.

HTTP URL (Web Service 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, Mixed, or Auto (default).

  • 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.

Environment (Local Windows Debugger)

Specifies environment variables for the program you are debugging. 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 ellipsis ( Visual Studio Ellipse Button) button appears. Click on the ellipsis ( Visual Studio Ellipse Button) button to edit environment variables.

Merge Environment (Local Windows Debugger)

Determines whether the variables specified in the Environment box will be merged with the environment defined by the operated 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.

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).

For details, see PDB Files and DBG Files

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, so debugging is difficult.

The default option (Disabled (/0d) suppresses optimization. You can develop with optimization suppressed, and then turn it on when creating 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 (/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:

  • 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 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