5. Running and debugging the program

Updated: April 19, 2023

To run and debug the newly built program on your target system, you simply need to select three things in the launch bar: your project, the target you'd like to run it on, and Debug:
Launch bar settings

Then click the Debug button in the launch bar (Debug icon).

The IDE switches to the Debug perspective and transfers your program from your development host to your target system, then starts it under the control of the debugger. The debugger stops in the first line of your program. In the Debug view, you'll see an overview of your process, including the call stack. Using the buttons in the main bar of this view, you can control the debugger.
Debug perspective

When you run or debug your application from the IDE, any input is read from the IDE's console, and any output goes to it. After execution has passed the line that calls puts(), you should see the “Hello World!!!” message in the Console window.

Using the Step Over button, you can jump to the next line of code:
Step over

During debugging, you can watch the Variables view on the right, which displays how your variables change. You can use the Step Into button to let the debugger go into the code of a function (which, of course, is useful only if you have the source code for this function).

To set a breakpoint, place the mouse pointer over the left border of the source display, right-click and choose Toggle Breakpoint from the context menu. The breakpoint is shown as a little circle, which you can also set or remove while you write your code.
Breakpoints

When the running program hits a breakpoint, it stops in the debugger, and you can, for example, examine your variables. If you click the Resume button, your program continues until the next breakpoint:
Resume button

To abort program execution, use the Terminate button:
Terminate button

After the program has finished running, you can use the Remove All Terminated Launches button (Remove All Terminated Launches buttons) to clear the information about all terminated processes from the Debug view.

Note: The debugger keeps the project's files open while the program is running. Be sure to terminate the debug session before you try to rebuild your project, or else the build will fail.

To run your program as a standalone binary (without the debugger), select Run in the launch bar, and then click the Run button (Run).

You can also use the System Information perspective's Target File System Navigator view (accessible through Window > Show View) to manually transfer your binary, and then run it by double-clicking on it (or by right-clicking on it and selecting Run).

It's also possible to leave the binary on a shared network drive on your development host, mount the drive on your QNX Neutrino target (see the entry for fs-cifs in the QNX Neutrino Utilities Reference), and run the binary from there.