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.
Note
The debug project settings in the Configuration Properties/Debugging category are different for UWP apps and for components that are written in C++. See Start a debug session (VB, C#, C++ and XAML).
Each debug property setting is automatically written and saved to the "per-user" file (.vcxproj.user) for your solution when you save your solution.
Specify which debugger to use in the Debugger to launch list box, as described in the following table. Your choice affects which properties are visible.
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're 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) Remote Command Arguments (Remote Windows Debugger) |
- Specifies arguments for the program you're debugging. For more information about ways to set command line args, see Specify command-line arguments. 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. If you need to escape characters in the command, you can use ASCII values, such as %25 to replace %. If you use the Start Debugging command, double quotes escape the preceding commands, such as "<" to replace <. |
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 is 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 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're 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 and Remote Windows Debugger) | Specifies environment variables for the program that you're 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 right column, an "Edit..." appears. Select that link to open the Property Editor and edit environment variables. To add multiple environment variables, use the Property Editor and add one variable per line. |
Merge Environment (Local Windows Debugger) | Determines whether the variables that are specified in the Environment box are 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 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 | 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 is 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 isn't 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 semicolon-delimited list of additional folders or files to copy to the deployment directory. The default setting is empty, which means that no additional folders or files are copied to the deployment directory. To copy the contents of a folder to the same folder in the Deployment Directory, specify a folder name. 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, which makes debugging more 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 has the format specified by /Z7, /Zd, Zi, or /ZI. |
Generate Program Database File (/PDB:name) | Specify the name of a program database (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 don't want to include private symbols in the PDB file. This option creates a second 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 don't 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 by using the Microsoft.VisualStudio.VCProjectEngine.VCDebugSettings interface. For more information, see VCDebugSettings.
Other project settings
To debug project types such as static libraries and DLLs, your Visual Studio project must be able to find the correct files. When source code is available, you can add static libraries and DLLs as separate projects to the same solution, to make debugging easier. For information on creating these project types, see Creating and using a Dynamic Link Library (DLL) and Creating a using a static library. With source code available, you can also create a new Visual Studio project by choosing File > New > Project From Existing Code.
To debug DLLs that are external to your project, see Debugging DLL projects. If you need to debug your own DLL project, but don't have access to the project for the calling application, see How to debug from a DLL project.