Build an executable for debugging

The debug process requires you to create executables compiled specifically for debugging. These executables contain additional debug information that lets the debugger make direct associations between the source code and the binaries generated from that original source. The IDE uses different icons to distinguish between they types of builds: an arrowhead icon for executables that weren't compiled for debugging, or a bug for those that were.

Although you can debug a regular executable, you'll get much more information and control by building debug variants of the executables. To build an executable with debugging information, you must pass the -g option to the compiler. If you're using a QNX-type project, the filename for the debug variant has _g appended to it.

To specify the -g option from the IDE for a C/C++ QNX project:
  1. In the Project Explorer view, right-click the project and select Properties.
  2. In the left pane, select QNX C/C++ Project.
  3. In the right pane, select the Build Variants tab.
  4. Under your selected build variants, make sure Debug is enabled.
  5. Click Apply.
  6. Click OK.
  7. Rebuild your project (unless you're using the autobuild feature).

For more information about setting project options, see Properties for all project types.

Before you can begin to debug your program, you must have a debug launch configuration configured because the IDE needs to know some basic information in order to debug your program. For information about creating a debug launch configuration, see Create a launch configuration.