# Debugging a program

You must create a debug launch configuration the first time you debug your program.

To create a debug configuration:

1. In C/C++ Projects view, select a project.
2. Click Run > Debug.
3. In the Debug dialog box, select a debug configuration type from the Configurations list.

4. Click New.

5. In the Name box, type a descriptive name for this debug configuration.
6. In the Project box, type the name of the project containing the application you want to debug.
7. In the C/C++ Application box, type the name of the executable that you want to run.
8. Click the Debugger tab.
9. Select Run program in debugger.
10. Select the Stop at main() on startup checkbox.
11. Click Debug.

The debug perspective is opened and the application window opens on top. The C/C++ editor window is repositioned in the perspective.

For more information:

- To specify the execution arguments an application uses and the working directory for a run configuration, see Specifying execution arguments.
- To set the environment variables and values to use when an application runs, see Setting environment variables
- To select a debugger to use when debugging an application, see Selecting a debugger
- To specify the location of source files used when debugging a C or C++ application, see Specifying the location of source files
- To specify where the run configuration is stored, how you access it and what perspective to open when running an application, see Specifying the location of the run configuration

To use a debug configuration:

You can reuse a previously created debug launch configuration to debug your program.

1. Click Run > Debug.
2. In the Debug dialog box, select a debug configuration from the Configurations list.
3. Click Debug.

Debug overview
Debug information

Debugging

Run and Debug dialog box