Main Page | Recent changes | Edit this page | Page history

Printable version | Disclaimers | Privacy policy

Not logged in
Log in | Help
 

FAQ

From KDevelop

You can find help on the syntax used by this wiki in the mediawiki editing help page

There is a non editable FAQ and a nutshell page in the user manual


Contents

[edit] File FAQs

[edit] Where is the Automake manager in KDevelop?

Click on the bottom tab on the right of KDevelop. Image:Automake_manager.png


[edit] How do I create New Files in a Project?

Select the sub-project in the upper half of the Automake Manager, then right-click in the lower half on the groups title you want to have the files added and select Create New File....


[edit] How do I remove a File from a Project?

Select the sub-project in the upper half of the Automake Manager, then in the lower half open the groups list you want to have the file removed from, right click on the file in this list and select Remove.


[edit] How to add existing files to a project?

The way you add existing files to a project is predicated on which build system you've chosen for your project. However, no matter what build system you are using you'll have to copy the existing sources into the src/ directory of your new KDevelop project.

Next:


[edit] Projects FAQs

[edit] How to convert my VC++ project?

KDevelop does not provide a way to automatically import your VC++ project. However, you can convert the project by creating a new KDevelop project using the New Project Wizard templates such as the C++->Simple Hello World template. Then you can copy the source files (*.cpp and *.h) from your VC++ project into the src/ directory of your new KDevelop Automake based project. Finally, follow the instructions above for adding existing files to a project.

A semi solution may be to use the dsw2make script, it takes a VC++ project file (*.dsw) with it's descendent dsp files and produces a Makefile for each one of them. Make sure it works as some mismatches may occur usually it related to the paths, case sensitivity and CR/LF. If a CR/LF problem appears use applications such as dos2unix or d2u to solve the problem. At this point you should have a regular project based on a makefiles chain. Import the project as an existing project.

[edit] How to create a truly empty project?

[edit] How to create a simple project with just a Makefile (also known as Custom Project) ?

Create a Custom Project. There is no direct way to create a custom project (i.e. a project which does use its own makefiles). Use Project->Import Existing Project instead. Remember to set the appropriate Project Type, labeled by an additional (Custom Makefiles) in the dialog. Use Project Options Early. Whenever you start a new project do not forget to set the Project->Project Options... to your needs.


[edit] How to create a simple Automake project with a directory hierarchy ?

If you want to create a project with a directory hierarchy, where each folder contains groups of cpp/h files which should built to a single executable binary file.

Ex:
  src
  src/gui
  src/gui/components
  src/logic
  src/logic/algorithms
  src/logic/sublogic


This can be accomplished using convenience libraries. Each subdirectory will be compiled and linked into a libtool-library, afterwards, all libtool-libs are linked together into one executable.

Ex:
 src/logic/base [libbase.la]
 src/logic/algorithm [libalgo.la]

Note: If you forgot a dependency, add the correct dependency, run clean for the subproject, and recompile the entire project (F8).


[edit] What do the "build configurations" (Project Options->Configure Options) mean?


[edit] What to do if project does not build again after switching to/from default target?

There is a problem with the automake/autoconf machinery. If Project->Build Configuration provides to select from three build directories: default, optimized, and debug, by all means stick to either the default or the debug/optimized targets.


[edit] How to add subprojects?

Select the automake-manager. In the upper half, you see the projects. To add a subproject, select the project to which you want to add a subproject and click on the icon "add subproject". A new folder is created with the name of the subproject (in the filesystem and the automake-manager).

You should now create a libtool-target for the new subproject. If you have done this, make this target active and add files to it.

The libtool-target in the subproject can be linked to your main binary-target by right-clicking it and select "settings". Under the tab "libraries" you select the appropriate help-library (.la file).

[edit] What to do when automake & friends fails with strange error messages?

Open a console window in your project root directory and type:

libtoolize --copy --force

It should solve the problem of conflicting autotools versions between KDevelop and your installed system.


[edit] I get "Wrong autoconf version" etc. Error. What can I do?

There are several error messages concerning too old versions of autoconf etc. preventing configure from working properly. Run autoreconf in the directory tree where the configure.in files in question are. This command will try to update the information in the GNU Build System files. See man autoreconf for more information. If you get:

*** YOU'RE USING autoconf (GNU Autoconf) 2.60.
*** KDE requires autoconf 2.53 or newer

then you need to replace the admin dir of your project with the one from KDE 3.5. You can do that by following these steps (assuming /home/user/projects/myproject as path for the project):


[edit] How can I develop with Qt4 and KDevelop-3.4.x?

      /usr/bin/qmake-qt4 (on a Debian Unstable System)
      /usr/bin/designer-qt4 (on a Debian Unstable System)

[edit] How can I develop with Qt4 and KDevelop-3.3.x?

#!/bin/sh
export QTDIR=/devel/kde/src/4/qt-copy
export PATH=$QTDIR/bin:$PATH
exec kdevelop $*

Open ~/.kde/share/config/kdeveloprc, find the [General Options] group (not [General]!), and add the line:

Embed KDevDesigner=false

Create ~/.kde/share/applnk/.hidden/designer.desktop with the following contents (adjust the path to Qt4)

[Desktop Entry]
Type=Application
Exec=/devel/kde/src/4/qt-copy/bin/designer
Name=Qt Designer
GenericName=Interface Designer
MimeType=application/x-designer
Icon=designer

The full path to designer is needed there, even though the PATH is correct in KDevelop. This is because KDevelop doesn't really start designer directly, it asks kdeinit to do so...


[edit] How can I set up a project with SCons?

SCons is a software construction tool. KDevelop (as of version 3.4.0) does not support SCons projects directly. However, it is possible to set up a project very simply using SCons by writing a "stub" Makefile and using the "Custom Makefiles" project type. An example of a simple stub Makefile is the following (note that lines after target names should be indented with tabs, not spaces):

project_name:
        scons
clean:
        scons --clean

This will enable the Build Project and Clean Project actions to work.

[edit] Libraries FAQ

[edit] What are the differences between .a, .so and .la libraries ?

There is a nice introduction to program libraries using the GNU toolset and there is an introduction to Libtool. Basically:


[edit] How to create a .so library?

There is also a libtool based method:

Now, you should have a new library named libxxx.so.0.0.0


[edit] How to create a .a library?


[edit] How to create a .la library (a.k.a. a libtool archive)?


[edit] How to add an external include path to a project?

When your project is GNU Autotools (Autoconf/Automake) based then you are most probably using the KDevelop Automake manager (see #Where is the Automake manager in KDevelop?). To add an include path to your project do:


[edit] How to link against a .so library?

When your project is GNU Autotools (Autoconf/Automake) based then you are most probably using the KDevelop Automake manager (see #Where is the Automake manager in KDevelop?). To link your program against a library, or to add a library do :

Do not forget to add the the location of the library's .h files to the include path of your executable like it's explained in #How to add an external include path to a project?


[edit] How to link against a .a library?

This is similar to #How to link against a .so library?


[edit] How to link against a .la library?

This is similar to #How to link against a .so library?

Addition: There's another, more convenient, way to link mybinary against somestuff.la. Let libsomestuff.la reside in $(somedir), then, instead of adding -lsomestuff -L$(somedir), just add $(somedir)/libsomestuff.la. The libtool utility can handle this.

The full process (adapted from above):

This is the same process/behaviour as if linking against convenience libraries within the same project, there, one just has to check the appropriate libraries in the top box (Link convenience libraries inside project).

The messy details: The library entries are added to mybinary_LDADD in the appropriate Makefile.am. The LDADD variable can handle libtool archives natively, i.e. it reads the locations of the actual libraries and add them accordingly.


[edit] How to link with libraries where the source within those libraries heavily depend on each other?

When you have simple dependencies, just add all libraries and reorder them with the move up and move down options. But when the libraries have cyclic and recursive on each other you need to use a different approach: In Target Options for "appName"->LDFLAGS->Other specify all cyclic and recursive static libs :

$(all_libraries) --start-group fullPathLib1.a fullPathLib2.a fullPathlibn.a --end-group

Then on Target Options for "appName"->Libraries->Link libraries outside project (LDADD) add the full path to the created library:

/fullPathToMyConcatenedLib.so

[edit] Debug FAQs

[edit] Debugging a console application : How do I get the console to show so I can enter data?

In the Project Options dialog, go to the Debugger tab and check Enable separate terminal for application IO


[edit] How to debug exec objects with libtool "temporary wrapper scripts"?

When building ltlibraries and linking exec with them, libtool creates wrappers about them, but gdb complains not in executable format: File format not recognized

To make it work do:
Project -> Project Options -> Debugger -> Debugging shell -> libtool --mode=execute 


[edit] Why does the debugger ignore/does not stop at breakpoints?

Autotools projects - Make sure you are using the debug configuration (see: #What to do if project does not build again after switching to/from default target?) or that you are compiling with "-g3 -O0" options.

QMake projects - You need to manually add CONFIG += debug to your *.pro files, and restart KDevelop.

[edit] Why does the debugger issue the error "no debug information or source" ?

Make sure you are using the debug configuration (see: #What to do if project does not build again after switching to/from default target?) or that you are compiling with "-g3 -O0" options.


[edit] How to do remote or cross debugging ?

See #How to set up a different compiler (native or cross compilers).

[edit] Code Completion FAQs

[edit] How can I enable code completion?

When you have any C/C++ project opened, go to menu Project->Project Options, in Project Options dialog choose C++ Specific tab, then Code Completion tab. Check the Automatic Code Completion check box and other assorted settings. Also in the Settings->Configure KDevelop->C++ Parsing dialog you can enable and vary the background parsing loop.


[edit] How to teach new macros to the C/C++ parser?

KDevelop's current parser does not parse files in order. If you need to teach new macros to the C/C++ parser, the best way to do this is to parse a fake file that contains only macro definitions before parsing the source files. This is what the C++ Parser Settings dialog is for. The contents of this fake source file is the text you edit in the C++ Parser Settings dialog, which will be parsed first anytime that you load a project.


[edit] How can I enable code completion for external libraries?

When you have any C/C++ project opened, go to menu Project->Project Settings, in Project Options dialog choose C++ Specific tab, then Code Completion tab. Push Add Persistent Class Store button and complete the New Persistent Class Store wizard. After completing the wizard, make sure that the newly created class store is checked in the list of persistent class stores at Code Completion tab.


[edit] Code completion still doesn't work

Try disabling the abbreviation part - it often presents a completion popup before the completion engine gets a chance to do so.

Try running the Add Persistent Class Store Wizard on your projects directory.

[edit] Why doesn't my Qt4 Persistent Class Store work for all Qt4 classes?

If you are using KDevelop 3.3.x or below the persistent class store won't work correctly when importing Qt4's include directories. Qt4's includes are mostly one-liners with '#include "../../src/blah.h", which KDevelop can't handle. To work around this, try using Qt4's src directory when creating the completion database.


[edit] KDevelop installation FAQs

[edit] How long does it usually take to compile kdevelop?

This depends on the speed of your machine. A developer has a P4 that runs at 3GHZ and it takes 40 minutes to compile KDevelop the first time. After updating from CVS, it usually takes less time. We would guess the average build time is between 1 and 2 hours after the initial download.

It's a good idea to use gcc-4.0.1. This will drastically reduce the compilation time. Debug compilations ("./configure --enable-debug=full" with -g -O0 flags) are sped up by 45% and release ("./configure --enable-debug=no" with -O2 flag) - by 16%. For example, on AthlonXP1600 / 256Mb RAM system fresh debug compilation takes 45 mins with gcc-4 and 81 mins with gcc-3.3.1. To speed up things even more, the most recent libtool (from CVS HEAD) can also be used.

It is usually safe to have gcc-4 installed in /usr/local among with gcc-3.x in /usr. It is also possible to compile only KDevelop with gcc-4 and leave the rest (Qt, KDE, etc.) without recompilation.

Note! Do not use gcc-4.0.0 because it miscompiles the code. gcc-4.0.1 and later versions are not vulnerable to this problem.


[edit] I get an error message "couldn't create a language plugin". What is wrong?

Just as any other KDE application, you have to make sure that KDevelop's plugins are recognized by KDE. Either install it into your KDE directory (configure --prefix=/opt/kde3 for example) or add KDevelop path to your KDEDIRS environment variable and rerun "kbuildsycoca". Example command line for bash (assuming KDevelop is installed in /home/harry/kdevelop):

export KDEDIRS=/home/harry/kdevelop:$KDEDIRS && kbuildsycoca


If the error is specifically "Could not create language plugin for C++.", try also making sure you have a valid bdb (Berkeley DB) installation.

You should see something like this:

ldd ~/devel/install/lib/libkdevcatalog.so | grep libdb
        libdb-4.3.so => /usr/lib64/libdb-4.3.so (0x00002ba8687c9000)

If you see something like this:

ldd ~/devel/install/lib/libkdevcatalog.so | grep libdb
       libdb-4.3.so => not found

then your distro's package management hasn't managed to track the bdb dependency correctly and you need to install a compatible bdb version.

[edit] I get an "error: qassistantclient.h: No such file or directory". What is wrong?

Your distribution (i.e SUSE, Mandriva, Fedora, Ubuntu) has split Qt 3 into several different packages. You will need to locate and install the development packages for the Qt 3 applications. Since the the names of these packages is distribution dependent, the KDevelop team can't provide an exact name of the package to install. Several possibilities exist, including:

If your distribution uses a package name not on this list, please add it here for others to reference.


[edit] I get an "error: possibly undefined macro: AM_PROG_LIBTOOL". What is wrong?

If you get something like this when trying to build/compile one of KDevelop's template applications:

configure.in: warning: macro `AM_PROG_LIBTOOL' not found in library
configure.in: error: possibly undefined macro: AM_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.

Then it means that you did not read the KDevelop requirements page properly. Please install libtool

[edit] Version Control Systems

[edit] What files should I check in my VCS?

Do not check in .pcs and .kdevses files

[edit] Working with Clearcase views and KDE

Clearcase files are typically stored under '/usr/vobs/...' and binary objects may contain references to this path. If your kdevelop project was defined using a different path (e.g. '/view/[view name]/usr/vobs'), you may experience problems with files being opened twice, confusing breakpoint behaviour and misleading file editing.

If kdevelop is started from a shell inside a clearcase view, it still will be unable to see '/usr/vobs/...' unless KDE was itself started in a clearcase view. The following approach solves these problems:

cp /etc/X11/xinit/xinitrc ~/.xinitrc
change the penultimate line from
exec $WINDOWMANAGER
to
/opt/rational/clearcase/rhat_x86/bin/cleartool setview -exec $WINDOWMANAGER ViewName

where ViewName is the name of the view you wish to use.

Unfortunately this does seem to cause problems with non-KDE applications (eg. firefox) and has locked up my machine. The other alternative is to use another window manager such as Gnome.

[edit] How to use the SVN plugin?

NOTE TO svn+ssh:// repository users.

If you try to initiate svn operation but fails with error message "connect closed unexpectedly", the problem is in authentication. Unlike other protocols such as svn:// , http:// or https:// , the authentication for svn+ssh:// is managed by ssh system. Subversion does not have any control over authentication.

When you started kdevelop with terminal, SSH will ask you a password through terminal. So you should enter the password into terminal.

But when you started kdevelop via menus (i.e., you didn't associate any terminal), you should install a small X11 program called "ssh-askpass" and set SSH_ASKPASS environment variable to that executable. After that when you try svn operation, ssh-askpass will ask you a password. That's it.

See manpages for ssh-agent.

GENERAL USAGE:

You need to manually checkout the project and source files from a subversion repository. Or you can import new project into repository at the time of project creation by project wizard.

After opening the project, go "Project" menu -> "Project Options" -> "Version control" tab. Select subversion combobox. Save the settings and reopen the project. Then the subversion context menu should appear when you right-click on files. Also each file/dir in FileTree view should be colored differently according to their status.

[edit] Code indentation

[edit] Does KDevelop provide on-line (as you type) code indentation aka smart indentation, aka auto indentation, aka on-the-fly indentation?

It does, KDevelop uses KatePart as it's text (code) editor and KatePart provides this functionality. It can be configured via Settings -> configure editor -> Indentation. KatePart is developed by the Kate development team, if you find bugs or have suggestions please contact them directly via their website http://kate-editor.org/

[edit] I do not like the on-line code indentation, does KDevelop provide other, more configurable, indenter?

Yes, KDevelop has an off-line code formater that you invoke via Edit->Reformat source. It can be configured using Project -> Project Options -> Formatting. It works by invoking an external tool called astyle. If you find bugs or have suggestions please contact the developers of that tool directly via their website http://astyle.sourceforge.net/


[edit] Legal FAQs

[edit] Am I allowed to develop proprietary (closed source, non-free) applications with KDevelop?

Everyone and all entities are free to use KDevelop. The generated code can be put under all licenses you wish. Therefore, the project generator has the fields for adding your own copyright notice to the generated files, but to make things simpler and to have an example, the default is a GPL license notice. So you can add your license notice there. When it comes to actually editing etc. your program, using KDevelop is just as using any other editor, it's a program that is GPL that is intended for use and doesn't have any implications on what you use it for. So you can write proprietary software with it despite the fact that KDevelop itself is GPL. Towards using KDE functions or any other stuff of free software, you only have to watch the licensing notes on the libraries you're going to use. So for development of proprietary KDE/Qt applications you only need a professional license from Trolltech. The KDE libraries itself are LGPL which means you can use the function calls and link your program to the KDE libraries. This counts for the kdelibs libraries, the kdebase libraries (konqueror and kcontrol etc.) and the koffice libraries (for creating koffice applications). For more information, please visit KDevelop Licensing

[edit] Am I allowed to develop proprietary plugins for KDevelop?

KDevelop includes a libkdeveloplgpl.so library to allow development of proprietary plugins. This library includes KDevelop interfaces and utility functions released under LGPL. If you have a professional license from Trolltech you can link your code with libkdeveloplgpl and release it under any license.

Note that this situation is analogous to the binary-only drivers situation in the Linux kernel, so you can expect the FSF not to approve this model.

[edit] Misc. FAQs

[edit] I am developing an application which needs exception handling. How can I make it?

Edit the file configure.in(.in) in your toplevel source directory. Here, you have to enter after the AC_CHECK_COMPILERS() macro:

CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS"

and after that you have to recreate your new "configure" by invoking

make -f Makefile.dist

at the toplevel source directory and then restart the configure script.


[edit] My configure.in.in hasn't any AC_CHECK_COMPILERS() call. Where should I put the CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS" mentioned above?

The new versions of configure.in.in has been simplified you can now add the line after the AM_INIT_AUTOMAKE(<package-name>,<version>).


[edit] Is there any HOWTO available on how to work with QT designer made dialogs ?

Yes, there is a great tutorial on http://women.kde.org/articles/tutorials/kdevelop3/index.html


[edit] Why don't I see the compilation error messages?

If during compilations you notice some valuable information is missing in the Messages Output View window, it may be that the level of message detail is set too low. Right-click in the window and select another detail level from the context menu.


[edit] How to add a translation to a KDE program?

First execute Build->Create Messages&Merge and after that add a new translation via Project->Add Translation. This creates a po/$lang.po file. The $project.pot file has all the strings in it.


[edit] How to add icons to a project?

First add a new subproject via the automake manager called pics. Then right-click the new subproject, choose Settings and then Prefix. Add a new prefix with for example mypics as name and the path $(kde_datadir)/$project/pics. After that create a new target in the pics subproject and choose Data as Primary, mypics as Prefix and add a dummy name. At last add your Icons to the new target. Loading the image can be performed by including the kiconloader.h header file and the following code which adds a pixmap with the name config to a button: button->setPixmap(UserIcon("config"))


[edit] How to set up a different compiler (native or cross compilers)

Compilers are set for a project:

Tab "General":

Tab "C":

Tab "C++":

Tab "Fortran":

Close the options, select your configuration in Project->Build Configuration, then run Automake & Friends, configure and make.

For example, to set up sparc-sun-solaris2.9 target cross-compiler do:

--host=i686-pc-linux-gnu -- build=sparc-sun-solaris2.9
sparc-debug

For cross debugging see Remote debugging using KDevelop 3.0 in comp.os.linux.embedded newsgroup or Cross_debugging. The kdevelop.org forum also contains some info about it.

Make sure that the binaries and libraries of the (cross-)compiler are available in $PATH and $LD_LIBRARY_PATH!

It might be necessary to change some autoconf/automake macros in configure.in to fully support your compiler -- see the last message in this thread kdevelop.org forum what to do to get gfortran (GNU F90 compiler) working.

Retrieved from "http://www.kdevelop.org/mediawiki/index.php/FAQ"

This page has been accessed 155,011 times. This page was last modified 11:42, 20 May 2008. Content is available under GNU Free Documentation License 1.2.


[Main Page]
Main Page
Community portal
Current events
Recent changes
Help
Donations

Edit this page
Discuss this page
Page history
What links here
Related changes

Special pages
Bug reports