KDevelop5/Manual/Running programs/en: Difference between revisions
Importing a new version from external source |
Updating to match new version of source page |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Running programs in KDevelop == | == Running programs in KDevelop == | ||
Once you have built a program, you will want to run it. To do this, need to configure ''Launches'' for your | Once you have built a program, you will want to run it. To do this, need to configure ''Launches'' for your project. A ''Launch'' consists of the name of an executable, a set of command line parameters, and an execution environment (such as "run this program in an external terminal", or "run this program in the debugger"). | ||
<span id="Setting up launches in KDevelop"></span> | <span id="Setting up launches in KDevelop"></span> | ||
=== Setting up launches in KDevelop === | === Setting up launches in KDevelop === | ||
[[ | [[File:Kdevelop-nano-launch-config.png|500px|thumb|center]] | ||
* Select <menuchoice>Run -> Configure launches</menuchoice> from the menubar. | |||
* Highlight the project you want to add a launch for and click on the {{Plus}}/<menuchoice>Add</menuchoice> button. | |||
* From the drop down menu shown, select the name of the launch configuration. | |||
* Enter the name you want to call the launch configuration (you can edit it later by double clicking it ). | |||
* In the executable tab, choose the project target or the path where you want to run the program. | |||
Any required command line arguments can be specified in the <menuchoice>Arguments:</menuchoice> edit box. | |||
[[ | [[File:KDevelop-arguments-config.png.png|800px|thumb|center]] | ||
If you need to build the executable or add libraries before running it,add the dependencies tab at the bottom of the page, | |||
* select <menuchoice>Build</menuchoice> from the dropdown <menuchoice>Action:</menuchoice> menu. | |||
* Select the {{Icon|folder}} symbol to the right of the textbox and select whatever target you want to have built. | |||
* Click Ok. | |||
{{Note|1= If you have configured multiple launches, you can choose which one should run when you hit <keycap>Shift + F9</keycap> by going to <menuchoice>Run -> Current Launch Configuration</menuchoice> | To configure a debug launch: | ||
* Select on the <menuchoice>Debug</menuchoice> symbol under the selected launch configuration on the left tab. | |||
* add the path to the debugger program. | |||
if this is the system's default debugger (e.g. '''gdb''' on Linux), then you don't need to do this step. | |||
[[File:Kdevelop-after-nano-run.png|650px|thumb|center]] | |||
To run the program: | |||
* From the menu bar, select <menuchoice>Run -> Execute Launch</menuchoice>or use the shortcut <keycap>Shift + F9</keycap>. | |||
Your program should now run in an external ''terminal window'' of '''KDevelop'''. The picture above shows the result: The new <menuchoice>Run</menuchoice> tool subwindow at the bottom shows the output of the program that is being run, in this case the '''''nano''''' text editing program. | |||
{{Note|1= If you have configured multiple launches, you can choose which one should run when you hit <keycap>Shift + F9</keycap> by going to <menuchoice>Run -> Current Launch Configuration</menuchoice>. There is a non-obvious way to edit the name of a configuration, however: in the dialog box you get when you select <menuchoice>Run -> Current Launch Configuration</menuchoice>, double-click on the name of the configuration in the tree view on the left, which will allow you to edit the configuration's name.}} | |||
<span id="Some useful keyboard shortcuts"></span> | <span id="Some useful keyboard shortcuts"></span> | ||
Line 24: | Line 44: | ||
|- | |- | ||
| <keycap>F8</keycap> | | style="width: 15%"|<keycap>F8</keycap> | ||
| Build (call make) | | style="width: 85%"|Build (call make) | ||
|- | |- | ||
| <keycap>Shift + F9</keycap> | | <keycap>Shift + F9</keycap> | ||
| Run | | Run | ||
|- | |- | ||
| <keycap>F9</keycap> | | <keycap>F9</keycap> | ||
| Run program in the debugger; you may want to set breakpoints beforehand, for example by right-clicking with the mouse on a particular line in the source code | | Run program in the debugger; you may want to set breakpoints beforehand, for example by right-clicking with the mouse on a particular line in the source code | ||
|- | |||
|} | |} | ||
{{Prevnext2 | {{Prevnext2 |
Latest revision as of 14:29, 6 September 2020
Running programs in KDevelop
Once you have built a program, you will want to run it. To do this, need to configure Launches for your project. A Launch consists of the name of an executable, a set of command line parameters, and an execution environment (such as "run this program in an external terminal", or "run this program in the debugger").
Setting up launches in KDevelop

- Select from the menubar.
- Highlight the project you want to add a launch for and click on the
/ button.
- From the drop down menu shown, select the name of the launch configuration.
- Enter the name you want to call the launch configuration (you can edit it later by double clicking it ).
- In the executable tab, choose the project target or the path where you want to run the program.
Any required command line arguments can be specified in the
edit box.
If you need to build the executable or add libraries before running it,add the dependencies tab at the bottom of the page,
- select from the dropdown menu.
- Select the
symbol to the right of the textbox and select whatever target you want to have built.
- Click Ok.
To configure a debug launch:
- Select on the symbol under the selected launch configuration on the left tab.
- add the path to the debugger program.
if this is the system's default debugger (e.g. gdb on Linux), then you don't need to do this step.

To run the program:
- From the menu bar, select Shift + F9. or use the shortcut
Your program should now run in an external terminal window of KDevelop. The picture above shows the result: The new
tool subwindow at the bottom shows the output of the program that is being run, in this case the nano text editing program.
Some useful keyboard shortcuts
Running a program | |
---|---|
F8 | Build (call make) |
Shift + F9 | Run |
F9 | Run program in the debugger; you may want to set breakpoints beforehand, for example by right-clicking with the mouse on a particular line in the source code |