KDevelop4/FAQ: Difference between revisions

From KDE UserBase Wiki
(Created page with "=== Screencasts === http://blip.tv/file/4437001 Shows you how to get started with a new project, how to build and execute it as well as basic debuggging. === How do I do start...")
 
(formatting change)
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=== Screencasts ===
<languages />
<translate>


==KDevelop4 FAQs== <!--T:1-->
=== Screencasts === <!--T:2-->
<!--T:3-->
http://blip.tv/file/4437001
http://blip.tv/file/4437001


Shows you how to get started with a new project, how to build and execute it as well as basic debuggging.
<!--T:4-->
This screencast shows you how to get started with a new project, how to build and execute it as well as do basic debuggging.
 
=== How do I do start new console application? === <!--T:5-->


=== How do I do start new console application? ===
<!--T:6-->
Go to <menuchoice>Project -> New from template</menuchoice>. Select <menuchoice>C++ -> No GUI (Cmake) -> Simple CMake-based C++ application</menuchoice> and edit the name on the bottom of the window and click <menuchoice>Next</menuchoice>.


Go to Project -> New from template. Select C++ -> No GUI (Cmake) -> Simple CMake-based C++ application and edit the name on the bottom of the window and click next.
<!--T:7-->
Then appears "Version Control System". Select "None" and click finish.
Then appears <menuchoice>Version Control System</menuchoice>. Select <menuchoice>None</menuchoice> and click <menuchoice>Finish</menuchoice>.
Then it asks you to configure build. Click Ok. Now you should have new project visible on Projects list. You can build it by pressing F8 or selecting Project->Build Selection.


To debug application you must add launch configuration. This is done from Run->
<!--T:8-->
Configure Launches.
Then it asks you to configure build. Click <menuchoice>Ok</menuchoice>. Now you should have new project visible on <menuchoice>Projects</menuchoice> list. You can build it by pressing <keycap>F8</keycap> or selecting <menuchoice>Project -> Build Selection</menuchoice>.
Add new launch by pressing '+'. You need to edit the 'Project Target' field to point a executable binary. It is same as your project name usually. Or you can just select executable to point the binary. You can also edit the launch name to be more informative than "New Native Application Configuration" by selecting it on left "Launch Configurations" list and pressing F2. Apply changes pressing Ok. Then you can add breakpoint to source code with right click -> Toggle Breakpoint. Debugging starts with Run -> Debug launch. On bottom of the screen you can select 'gdb console' tab, and you can use enter commands gdb console.


<!--T:9-->
To debug an application you must add launch configuration. This is done from <menuchoice>Run->
Configure Launches</menuchoice>.


=== How do I import an existing project? ===
<!--T:10-->
Add new launch by pressing <menuchoice>+</menuchoice>. You need to edit the <menuchoice>Project Target</menuchoice> field to point a executable binary. It is same as your project name usually. Or you can just select executable to point the binary. You can also edit the launch name to be more informative than <menuchoice>New Native Application Configuration</menuchoice> by selecting it on left <menuchoice>Launch Configurations</menuchoice> list and pressing <keycap>F2</keycap>. Apply changes pressing <menuchoice>Ok</menuchoice>. Then you can add breakpoint to source code with <menuchoice>right click -> Toggle Breakpoint</menuchoice>. Debugging starts with <menuchoice>Run -> Debug launch</menuchoice>. On bottom of the screen you can select <menuchoice>gdb console</menuchoice> tab, and you can use enter commands '''gdb''' console.


Go to Project -> Open/Import project and select the folder of your project. Alternatively select your main makefile or <tt>CMakeLists.txt</tt>. Follow the wizard.
=== How do I import an existing project? === <!--T:11-->


=== How do I setup KDevelop to run my application? ===
<!--T:12-->
Go to <menuchoice>Project -> Open/Import project</menuchoice> and select the folder of your project. Alternatively select your main makefile or <tt>CMakeLists.txt</tt>. Follow the wizard.


Go to Run -> Configure Launches, select your project to the left, press the plus-button. Make sure the type of the "new launch configuration" (give it a proper name!) is "Native Application". Now go to the "project target" field to the left and type in the path to your target. Start with your projects name, it has auto completion.
=== How do I setup KDevelop to run my application? === <!--T:13-->


'''Note:''' we are well aware that this is a mess and needs to be improved...
<!--T:14-->
Go to <menuchoice>Run -> Configure Launches</menuchoice>, select your project to the left, press the plus-button. Make sure the type of the <menuchoice>new launch configuration</menuchoice> (give it a proper name!) is <menuchoice>Native Application</menuchoice>. Now go to the <menuchoice>Project target</menuchoice> field to the left and type in the path to your target. Start with your projects name, it has auto completion.


=== How do I debug my application in KDevelop? ===
<!--T:15-->
{{Note|1=We are well aware that this is a mess and needs to be improved...}}


=== How do I debug my application in KDevelop? === <!--T:16-->
<!--T:17-->
If you setup a launch configuration (see above) you should be able to run that in debug mode as well.
If you setup a launch configuration (see above) you should be able to run that in debug mode as well.


'''Note:''' make sure you build with debug symbols enabled. The default for new CMake projects is the "Debug" type, hence it should hopefully work out-of-the-box.
<!--T:18-->
{{Note|1=Make sure you build with debug symbols enabled. The default for new '''CMake''' projects is the <menuchoice>Debug</menuchoice> type, hence it should hopefully work out-of-the-box.}}


=== How do I get pretty printed variable contents while debugging? ===
=== How do I get pretty printed variable contents while debugging? === <!--T:19-->


<!--T:20-->
Make sure your <tt>~/.gdbinit</tt> looks similar to this:
Make sure your <tt>~/.gdbinit</tt> looks similar to this:
</translate>


<pre>
{{Input|<syntaxhighlight lang="python">
python
python
import sys
import sys
Line 51: Line 72:


end
end
</pre>
</syntaxhighlight>}}


<translate>
<!--T:26-->
Of course you have to adapt the path to point to the pretty printers.
Of course you have to adapt the path to point to the pretty printers.


=== What kind of build environments does KDevelop 4 support? ===
=== What kind of build environments does KDevelop 4 support? === <!--T:27-->


cmake, any other make-file based project via "custom makefile", generic...
<!--T:28-->
'''cmake''', any other make-file based project via <menuchoice>custom makefile</menuchoice>, generic...


=== How do I use Subversion from within KDevelop 4? ===
=== How do I use Subversion from within KDevelop 4? === <!--T:29-->
For subversion support you need to have it enabled on compile time. If that is the case, then you can right click your project files and find 'subversion'-item from the pop-up menu. There you can find common tasks, like 'update' and 'commit'.


=== Where is search/replace in files ? ===
<!--T:30-->
It is not currently implemented in Kdevelop 4. One option to do search/replace on command line is with 'rpl — replace strings in files' utility.
For '''subversion''' support you need to have it enabled on compile time. If that is the case, then you can right click your project files and find <menuchoice>subversion</menuchoice> item from the pop-up menu. There you can find common tasks, like <menuchoice>Update</menuchoice> and <menuchoice>Commit</menuchoice>.


=== What are workingsets and how do I use them? ===
=== Where is search/replace in files ? === <!--T:31-->


<!--T:32-->
Starting with version 4.2, '''KDevelop''' ships by default with a search/replace in files plugin. Access it via the menu or from the context menu, e.g. in project view or on a selection in the editor.
=== How can I special-case C/C++ code specifically for KDevelop? === <!--T:36-->
<!--T:37-->
The C/C++ support for '''KDevelop''' defines the macros <tt>IN_KDEVELOP_PARSER</tt> and <tt>IN_IDE_PARSER</tt> which you can use in your source code as required to workaround limitations or define custom macros etc.
=== What are workingsets and how do I use them? === <!--T:38-->
<!--T:34-->
Todo
Todo
=== How to add include or library directory to compile option? === <!--T:33-->
<!--T:39-->
This depends on your build toolchain (CMake, QMake, autotools, ...), please refer to the documentation thereof. There is a [http://www.cmake.org/cmake/help/cmake_tutorial.html CMake tutorial] for example.
<!--T:40-->
For cases where '''KDevelop''' is still not figuring out the include path properly after you have configured your build toolchain, you can manually add include paths on a per-directory basis into a <tt>.kdev_include_paths</tt> file. This can be done from inside '''KDevelop''' by running the "solve problem" wizard associated with a "could not find include file" problem, e.g. by hovering the problematic <code>#include</code> line.
<!--T:35-->
[[Category:Development]]
</translate>

Latest revision as of 16:37, 16 January 2012

Other languages:

KDevelop4 FAQs

Screencasts

http://blip.tv/file/4437001

This screencast shows you how to get started with a new project, how to build and execute it as well as do basic debuggging.

How do I do start new console application?

Go to Project -> New from template. Select C++ -> No GUI (Cmake) -> Simple CMake-based C++ application and edit the name on the bottom of the window and click Next.

Then appears Version Control System. Select None and click Finish.

Then it asks you to configure build. Click Ok. Now you should have new project visible on Projects list. You can build it by pressing F8 or selecting Project -> Build Selection.

To debug an application you must add launch configuration. This is done from Run-> Configure Launches.

Add new launch by pressing +. You need to edit the Project Target field to point a executable binary. It is same as your project name usually. Or you can just select executable to point the binary. You can also edit the launch name to be more informative than New Native Application Configuration by selecting it on left Launch Configurations list and pressing F2. Apply changes pressing Ok. Then you can add breakpoint to source code with right click -> Toggle Breakpoint. Debugging starts with Run -> Debug launch. On bottom of the screen you can select gdb console tab, and you can use enter commands gdb console.

How do I import an existing project?

Go to Project -> Open/Import project and select the folder of your project. Alternatively select your main makefile or CMakeLists.txt. Follow the wizard.

How do I setup KDevelop to run my application?

Go to Run -> Configure Launches, select your project to the left, press the plus-button. Make sure the type of the new launch configuration (give it a proper name!) is Native Application. Now go to the Project target field to the left and type in the path to your target. Start with your projects name, it has auto completion.

Note

We are well aware that this is a mess and needs to be improved...


How do I debug my application in KDevelop?

If you setup a launch configuration (see above) you should be able to run that in debug mode as well.

Note

Make sure you build with debug symbols enabled. The default for new CMake projects is the Debug type, hence it should hopefully work out-of-the-box.


How do I get pretty printed variable contents while debugging?

Make sure your ~/.gdbinit looks similar to this:

python
import sys
sys.path.insert(0, '/home/milian/projects/compiled/kde4/share/apps/kdevgdb/printers')

from qt4 import register_qt4_printers
register_qt4_printers (None)

from kde4 import register_kde4_printers
register_kde4_printers (None)

from libstdcxx import register_libstdcxx_printers
register_libstdcxx_printers (None)

end

Of course you have to adapt the path to point to the pretty printers.

What kind of build environments does KDevelop 4 support?

cmake, any other make-file based project via custom makefile, generic...

How do I use Subversion from within KDevelop 4?

For subversion support you need to have it enabled on compile time. If that is the case, then you can right click your project files and find subversion item from the pop-up menu. There you can find common tasks, like Update and Commit.

Where is search/replace in files ?

Starting with version 4.2, KDevelop ships by default with a search/replace in files plugin. Access it via the menu or from the context menu, e.g. in project view or on a selection in the editor.

How can I special-case C/C++ code specifically for KDevelop?

The C/C++ support for KDevelop defines the macros IN_KDEVELOP_PARSER and IN_IDE_PARSER which you can use in your source code as required to workaround limitations or define custom macros etc.

What are workingsets and how do I use them?

Todo


How to add include or library directory to compile option?

This depends on your build toolchain (CMake, QMake, autotools, ...), please refer to the documentation thereof. There is a CMake tutorial for example.

For cases where KDevelop is still not figuring out the include path properly after you have configured your build toolchain, you can manually add include paths on a per-directory basis into a .kdev_include_paths file. This can be done from inside KDevelop by running the "solve problem" wizard associated with a "could not find include file" problem, e.g. by hovering the problematic #include line.