KDevelop5/Manual/Running programs: Difference between revisions

From KDE Wiki Sandbox
m (Minor text change)
m (Improve table layout)
Line 32: Line 32:


</translate>
</translate>
{| class="wikitable" style="border:1px solid" width="500"
{| class="tablecenter" style="border:1px solid" width="500"
! colspan="2" style="background:#ffff99; text-align:center" |<translate> <!--T:13-->
! colspan="2" style="background:#ffff99; text-align:center" |<translate> <!--T:13-->
Running a program
Running a program
|-style="font-weight:bold; text-align:left;"
! width=15% style=" border:1px solid gray;"| Shortcut
! width=85% style=" border:1px solid gray;"| Result
|-
|-


<!--T:14-->
<!--T:14-->
| <keycap>F8</keycap>  
| style="width: 15%"|<keycap>F8</keycap>  
| Build (call make)
| style="width: 85%"|Build (call make)
|-
|-



Revision as of 14:09, 2 April 2020

Other languages:

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

To set this up go to menu item Run -> Configure launches, highlight the project you want to add a launch for, and click on the button. Then enter the name and location of the executable, and the path where you want to run the program. Any required command line arguments if any, can be specified in the Arguments: edit box. If running the executable depends on building the executable and/or other libraries first, then you may want to add them to the list at the bottom: select Build from the dropdown Action: menu, then hit the symbol to the right of the textbox and select whatever target you want to have built. While you're there, you may as well also configure a debug launch by clicking on the Debug symbol and adding the name of 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.

You can now try to run the program: Select Run -> Execute Launch from KDevelop's main window menu (or hit Shift + F9) and your program should run in an external terminal window of KDevelop. The picture above shows the result: The new Run tool subwindow at the bottom shows the output of the program that is being run, in this case the nano text editing program.

Note
If you have configured multiple launches, you can choose which one should run when you hit Shift + F9 by going to Run -> Current Launch Configuration. There is a non-obvious way to edit the name of a configuration, however: in the dialog box you get when you select Run -> Current Launch Configuration, 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.


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