Jump to content

KDevelop4/Manual/Running programs: Difference between revisions

From KDE UserBase Wiki
Bangerth (talk | contribs)
Claus chr (talk | contribs)
m Formatting changes
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Running programs in KDevelop ==
<languages />
<translate>


Once you have built a program, you will want to run it. To do this, need to configure '''Launches''' for your projects. 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 a shell", or "run this program in the debugger").
== Running programs in KDevelop == <!--T:1-->


[[Image:kdevelop-2.png|thumb|400px|right]]
<!--T:2-->
Once you have built a program, you will want to run it. To do this, need to configure ''Launches'' for your projects. 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 a shell", or "run this program in the debugger").


To set this up go to menu item <menuchoice>Run > Configure launches</menuchoice>, highlight the project you want to add a launch for, and click on the red "+" button. Then enter the name of the executable, and the path where you want to run the program. 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 menu, then hit the folder symbol to the right of the textbox and select whatever target you want to have built. In the example to the right, I have selected the target "all" from project "1.deal.II" and "step-32" from project "1.step-32" to make sure both the base library and the application program have been compiled and are up to date before the program is actually executed. 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.
</translate><span id="Setting up launches in KDevelop"></span><translate>


[[Image:kdevelop-3.png|thumb|650px|right]]
=== Setting up launches in KDevelop === <!--T:3-->


You can now try to run the program: Select <menuchoice>Run > Execute Launch</menuchoice> from KDevelop's main window menu (or hit Shift-F9) and your program should run in a separate subwindow of KDevelop. The picture at the right shows the result: The new "Run" tool subwindow at the bottom shows the output of the program that is being run, in this case of the step-32 program.
<!--T:4-->
[[Image:kdevelop-2.png|thumb|400px|center]]


{{Note|1= If you have configured multiple launches, you can choose which one should run when you hit Shift-F9 by going to <menuchoice>Run > Current Launch Configuration</menuchoice>. Unfortunately, by default, all launches are named "New Native Application" without an <i>obvious</i> possibility of renaming them, making it difficult to distinguish them when selecting the current launch configuration (see [https://bugs.kde.org/show_bug.cgi?id=272300 KDevelop bug 272300]). 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.}}
<!--T:5-->
To set this up go to menu item <menuchoice>Run -> Configure launches</menuchoice>, highlight the project you want to add a launch for, and click on the {{Plus}} button. Then enter the name of the executable, and the path where you want to run the program. 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 <menuchoice>Build</menuchoice> from the dropdown menu, then hit the {{Icon|folder}} symbol to the right of the textbox and select whatever target you want to have built. In the example above, I have selected the target <menuchoice>all</menuchoice> from project '''''1.deal.II''''' and '''''step-32''''' from project '''''1.step-32''''' to make sure both the base library and the application program have been compiled and are up to date before the program is actually executed. While you're there, you may as well also configure a debug launch by clicking on the <menuchoice>Debug</menuchoice> 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.


=== Some useful keyboard shortcuts ===
<!--T:6-->
[[Image:kdevelop-3.png|thumb|650px|center]]


{| border="1" cellspacing="0"
<!--T:7-->
!colspan="2" style="background-color:#ffff99;" | Running a program  
You can now try to run the program: Select <menuchoice>Run -> Execute Launch</menuchoice> from '''KDevelop's''' main window menu (or hit <keycap>Shift + F9</keycap>) and your program should run in a separate subwindow 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 of the '''''step-32''''' program.
 
<!--T:8-->
{{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>. Unfortunately, by default, all launches are named ''New Native Application'' without an ''obvious'' possibility of renaming them, making it difficult to distinguish them when selecting the current launch configuration (see [https://bugs.kde.org/show_bug.cgi?id=272300 KDevelop bug 272300]). 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.}}
 
 
</translate><span id="Some useful keyboard shortcuts"></span><translate>
 
=== Some useful keyboard shortcuts === <!--T:9-->
 
</translate>
{| class="tablecenter" style="border:1px solid" width="500"
! colspan="2" style="background:#ffff99; text-align:center" |<translate> <!--T:13-->
Running a program
|-
|-
| F8
 
<!--T:14-->
| <keycap>F8</keycap>
| Build (call make)
| Build (call make)
|-
|-
| Shift-F9
 
<!--T:15-->
| <keycap>Shift + F9</keycap>
| Run
| Run
|-
|-
| F9      
 
<!--T:16-->
| <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
|}
 
</translate>|}<translate>
 
<!--T:11-->
{{Prevnext2
| prevpage=Special:MyLanguage/KDevelop4/Manual/Building_(compiling)_projects_with_custom_Makefiles | nextpage=Special:MyLanguage/KDevelop4/Manual/Debugging_programs
| prevtext=Building (compiling) projects with custom Makefiles | nexttext=Debugging programs
| index=Special:MyLanguage/KDevelop4/Manual | indextext=Back to menu
}}
 
<!--T:12-->
[[Category:Development]]
</translate>

Latest revision as of 05:49, 12 June 2011

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 projects. 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 a shell", 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 of the executable, and the path where you want to run the program. 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 menu, then hit the symbol to the right of the textbox and select whatever target you want to have built. In the example above, I have selected the target all from project 1.deal.II and step-32 from project 1.step-32 to make sure both the base library and the application program have been compiled and are up to date before the program is actually executed. 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 a separate subwindow 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 of the step-32 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. Unfortunately, by default, all launches are named New Native Application without an obvious possibility of renaming them, making it difficult to distinguish them when selecting the current launch configuration (see KDevelop bug 272300). 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