Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up headers and libraries for Linux development

I recently set up, for a learning exercise, an Ubuntu desktop PC with KDE 4.2, installed Eclipse and started to look for information on how to develop for KDE. I know there's KDevelop and will probably have a look at that at some time in the future. Right now, however, I don't have the correct headers and libraries for creating KDE applications in C/C++ using Eclipse. If I have the following:

#include <kapplication.h>

it fails to compile since there are dependancies on other header files that are not present on my hard disk or reference classes that aren't declared anywhere.

So, the question is, what packages do I need to install in order to have the correct set of headers to allow me to write applications for KDE 4.2? Are there any packages I shouldn't have? Alternatively, if there are no packages then where can I get the appropriate files?

As a corollary, are there any good tutorials on KDE development, something like the Petzold Windows book?

EDIT: Clarifying what I'm really after: where can I download the correct set of header files / libraries in order to build a KDE application? IDEs to compile code aren't a real problem and are easy to get, as is setting up compiler options for include search paths and so on. Does the KDevelop package have all the correct include and library files or are they separate? I guess they are separate as KDevelop is an IDE that can do other languages as well, but I'm probably wrong. So, the KDE/Qt header files I have don't work, where do I get the right ones?

Skizz

like image 315
Skizz Avatar asked Feb 05 '09 11:02

Skizz


3 Answers

Make sure you have installed the build-essential package. For more documentation available from the command line, install glibc-doc, manpages-dev, gcc-*-doc, libstdc++*-doc (replace '*' with suitable version numbers for your system)

Getting Started/Build/KDE4/Kubuntu and Debian had a pair of sudo aptitude install commands which I used to get some required packages. I also got the KDevelop and QDevelop applications, although I'm not sure they are required. There was also another package I needed (kdelibs5-dev) and this one appears to be the key package. Everything eventually worked after getting that one. Eclipse and KDevelop were both happy building a simple application once the compiler settings were set up; Eclipse required setting search paths and library filenames.

From first impressions, Eclipse appears better than KDevelop for the single reason that the tool windows in Eclipse can be detached from the main window and float - useful on a dual monitor setup. I couldn't see anyway to do that in KDevelop (I'm sure someone will comment on how to do this).

like image 144
dmityugov Avatar answered Sep 30 '22 04:09

dmityugov


To get all the dependencies required to build an app on Debian (and presumably Ubuntu), use "apt-get build-dep". So pick a random KDE app -- kasteroids? -- and run:

apt-get build-dep kasteroids

No need to guess what tools and libraries you need to build a KDE app.

like image 39
Ken Avatar answered Sep 30 '22 06:09

Ken


You might have some clue as to what include in your .classpath and .project files if you have a look and examine the content of the CMake used for developing application for KDE4.2

I believe the development section of their KDE site is quite complete when it comes to explain their development environment.
alt text
(source: kde.org) especially their Programming tutorials section.

like image 39
VonC Avatar answered Sep 30 '22 05:09

VonC