Next Previous Table of Contents

### 5. Installing KDE 2

In this chapter we will first go through a couple of steps that will help you set up KDevelop for creating KDE 2 / Qt 2.x applications. The requirements are:

- a current Qt-2.1 snapshot available at http://www.troll.no
- a current KDE 2 snapshot of the packages `kdesupport` and `kdelibs`

Both the Qt-2.1 and KDE 2 libraries are currently under development but are to be expected as final and changes to be expected for the final versions are marginal and may not even affect your application. This means you're getting to know the newest libraries coming up- and you're in charge of a valuable time-saving to create your application even before the libraries are completed.

The following sections describe what to do in detail within three steps:

- installing the Qt library
- installing the KDE libraries
- setting up KDevelop

Then you're ready to go and we'll proceed with creating the first step of the example program KScribble in the next chapter.

### 5.1 Setting up Qt-2.1

This first step will lead you to the minimum requirement to follow our example- which implies that there is a possibility to avoid installing KDE 2 if you're only interested in creating Qt-only programs. As Qt-2.1 contains all needed classes and KDevelop providing a project template for multiple document interface applications for Qt-2.1 as well based on the same framecode that is used in the KDE 2 template, you should have no problem at all following the example with a Qt-only application.

Now, to get the newest Qt library, get a recent version from the Troll Tech website at http://www.troll.no, section download. Then change to root and copy the tarball to the directory where your currently used Qt version is placed as well - on a SuSE Linux system this would be `/usr/lib`, where you should have a directory for either qt-1.44 or qt-2.0.2, depending on the distribution version. Untar the library sources with

`tar zxvf qtxxx.tar.gz`

depending on the name of the tarball. Then set the environment variable `QTDIR` to point to the directory where your new Qt-2.1 library is placed with e.g. `setenv QTDIR=/usr/lib/qt-2.1`. Another solution would be to move the qt-1.44 directory, usually just named qt, to qt-1.44 and create a symlink that for now has to point to qt-2.1, after the library is build, change it back to point to the qt-1.44 directory.

Change to the Qt-2.1 directory and type:

> `

>     ./configure
>     make

> `

You can change back your QTDIR variable to point to your qt-1.44 installation after successfully compiling the Qt-2.1 library.

Now switch to the directory `/usr/lib/qt-2.1/lib` and copy the created libraries to `/usr/lib` exept the symbolic link `libqt.so`.

Then you're done with Qt and you can proceed to the next step, setting up KDE 2 libraries. If you want to develop for Qt only, proceed to section Setting up KDevelop.

### 5.2 Setting up KDE 2 Libraries

The second step leads you to install the needed KDE libraries. Download a recent snapshot of the library packages `kdesupport` and `kdelibs` from http://www.kde.org. Then things will go a bit easier than for the Qt library. Just untar the sources to your directory and change to the kdesupport directory first. There, type:

> `

>     ./configure --with-qt-dir=/usr/lib/qt-2.1 --prefix=/opt/kde2
>     make

>     and as root:

>     make install

> `

This will install the kdesupport package to the directory given in the --prefix option and compile using the new build Qt-2.1 library, to which you give the path to configure by the option --with-qt-dir.

The same applies to the kdelibs package, just change to the kdelibs directory and type the same as above for the kdesupport package.

Then you're done with setting up the requirements for the needed libraries to build a KDE 2 application.

As a note aside, the KDE library package contains support for automatic HTML documentation generation, which you can easily get by installing KDoc, version 2.x. Then type `makekdedoc` in your kdelibs directory and KDoc will create the HTML documentation in a subdirectory `srcdoc`. In KDevelop you can access the KDE library documentation online with setting the KDE library documentation path in the KDevelop Setup dialog to point to `kdelibs/srcdoc`. On the same way set your Qt-Online documentation path in KDevelop to point to `/usr/lib/qt-2.1/html`, so you can access the documentation right away from within KDevelop.

If you successfully installed the Qt-2.1 and KDE 2 libraries, you're just one step away from creating your first KDE 2 application, you just need to give KDevelop the needed information where you installed the libraries - which we'll do in the next section.

### 5.3 Setting up KDevelop

This part is somewhat the easiest in the whole configuration process for KDE 2 development: Setting up KDevelop. Just open KDevelop, then select "Options"->"KDevelop Setup" to access the KDevelop configuration. There, change to the last page, titled "Path". This page contains two entry fields, one for the Qt library and one for the KDE 2 libraries. As you have successfully installed everything, select `/usr/lib/qt-2.1` for the Qt-2.x library path and `/opt/kde2` for the KDE 2 library path. Press the "OK" button and you're done.

Users that only want to develop for Qt-2.x (including the current Qt-2.0.2 version) just have to set the Qt-2.x library path.

Now we can proceed to the next chapter where we will create the first step of the KScribble example.

Next Previous Table of Contents