Developing C/C++ Applications with the KDevelop IDE
The aim of this article is to enable you to create an application with the KDevelop Integrated Development Environment (IDE) on a Linux/UNIX system running KDE 2. We explain this process by creating a sample application that gives some insight into the development framework and how it works. This might require getting your development environment set up correctly, so that you can work efficiently when getting started with your very own application or extension for the KDE 2 Desktop.
An IDE provides the user with a complete set of tools that integrate into one graphical environment. It's an enormous bonus for developers if the environment remains flexible enough to handle things separately or outside of the IDE, so they are not forced to use the IDE's features where they think other tools are more appropriate.
Although IDEs on other platforms, especially on Microsoft operating systems, come with all the tools bundled into one package, it's very different on a UNIX system. With UNIX, the compiler, which is needed to create applications from the programming code that can be run on a machine, is part of the operating system. Various tools that can be used in conjunction with the compiler, like make or the GNU tools, are delivered as separate packages, and an IDE makes use of these tools internally.
The KDE Project, comes with an IDE called KDevelop. This IDE can be used on any UNIX system to develop software, especially KDE software, but not limited to it. Many experienced UNIX programmers use it for plain C and C++ programming.
If you're using a popular Linux distribution, you should encounter few problems when setting up the IDE; especially when it already ships with KDevelop and takes over the installation of all the tools needed. What you need, in any case, is a C/C++ compiler, such as the current version of gcc that ships with current distros.
The next task is installing the GNU tools autoconf and automake and the package-building utility make.
For finding program errors, you need to install a debugger installed, which is called gdb, the GNU debugger. To complete your environment, the version control management utility, CVS, can be helpful, as well as source code documentation software, such as kdoc and doxygen.
The last package you need is KDevelop itself; it can be downloaded from the KDE web site at www.kde.org or from your distribution's web site.
If these requirements are all met, you still might be missing at least one very important part of your development environment, especially for KDE programming: the header files of the libraries that you intend to use. These files contain the API (application programming interface) that the compiler needs to have in order to look up which functionality you want to use while compiling your application.
The header files (also known as include files) should be located in your $KDEDIR/include (KDE header files) and your $QTDIR/include (Qt header files) directories. Make sure you have these installed; usually they're in packages with names such as kde-devel and qt-devel.
Further, there is the Qt Designer, a graphical user interface builder that is easy to use and works together with KDevelop to create KDE/Qt applications, so make sure that you have it installed as well.
Note: the KDEDIR and QTDIR environment variables should point to the directories where your KDE 2 and Qt 2.x installations are located, e.g., in your ~/.bashrc: export KDEDIR=/opt/kde2; export QTDIR=/usr/lib/qt-2.3.0.
As a programming beginner, it is crucial to have a successful experience. Let's start with creating your first KDE application. Open up KDevelop and make yourself comfortable with the environment.
In the treeview on the left side, you should see some books that you can unfold and that contain documentation included with KDevelop--almost 500 pages that can help you in almost every development situation. The second folder in that tree contains books with the API documentation of the Qt and KDE libraries.
In case you don't see them, set the appropriate paths in KDevelop through Options-->KDevelop Setup in the Documentation section. The other windows in the treeview will be used during development, and we will refer to them later. The right-hand window contains three tabs: two editor windows and a browser window, which will display the HTML documentation you select on the left treeview (see Figure 1).
The window on the bottom will be used to inform you about what your environment is currently doing; it will show the compiler output later on and display any error messages.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
|Secure Desktops with Qubes: Installation||May 28, 2016|
|CentOS 6.8 Released||May 27, 2016|
|Secure Desktops with Qubes: Introduction||May 27, 2016|
|Chris Birchall's Re-Engineering Legacy Software (Manning Publications)||May 26, 2016|
|ServersCheck's Thermal Imaging Camera Sensor||May 25, 2016|
|Petros Koutoupis' RapidDisk||May 24, 2016|
- Secure Desktops with Qubes: Introduction
- Secure Desktops with Qubes: Installation
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- CentOS 6.8 Released
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- ServersCheck's Thermal Imaging Camera Sensor
- Chris Birchall's Re-Engineering Legacy Software (Manning Publications)
- Petros Koutoupis' RapidDisk
- Oracle vs. Google: Round 2
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide