Hack 26 Develop Applications

 < Day Day Up > 

figs/moderate.gif figs/hack26.gif

Use Kdevelop with all of the languages Knoppix supports to rapidly create and manage software projects .

One of the great things about Linux, and open source in general, is that it isn't an exclusive club. Anyone who has the ability can contribute to his favorite projects or start a new open source project of his own. Basically, Knoppix is built from open source code, so it isn't surprising that Knoppix itself includes many of the programs you need to develop and build software of your own.

While Knoppix includes compilers and interpreters for many different languages, including C, C++, Perl, Python, Tcl/Tk, and others, it also includes a complete Integrated Development Environment (IDE), called Kdevelop, which combines all of the different tools, templates, programs, and scripts that developers frequently need into a single application. Kdevelop can handle your software development from picking a language to writing and debugging your code, reading documentation, compiling and running your program, and even keeping development in sync with applications, such as CVS and Subversion.

To start Kdevelop, click K Menu Development Kdevelop. The default window (Figure 3-4) has a number of toolbars that provide you with quick access to common functions so you can compile, execute, and debug your program with the push of a few buttons . On the toolbar are also shortcuts to all of the classes and functions in a program. Along the bottom of the window is a tab bar that lets you switch the bottom panel to show output from compiler messages, application output, CVS output, and a number of other programs.

Figure 3-4. The default Kdevelop window
figs/kph_0304.gif

This hack walks you through the steps of building a simple "Hello World" program in Kdevelop, so you can see just how easy it is to manage a program with Kdevelop.

To start a new project, click Project New Project. In the project wizard that appears, select the language in which you wish to program to see a list of Kdevelop's predefined templates (Figure 3-5). For most languages, Kdevelop displays only basic "Hello World" templates, but for C, and C++ especially , Kdevelop provides templates for a basic Gnome application and a number of KDE applications, applets, and plug-ins. Select your language and template, and name your project. If you are using CVS or Subversion on your project for version control, select it in the next window. Then configure the header for your source code files. Here, you can put any licensing or contact information you want to include with your code.

Figure 3-5. Kdevelop project templates
figs/kph_0305.gif

When the wizard completes, the main Kdevelop screen contains the skeleton code for your application (Figure 3-4). From this point, you can add functions and classes, and otherwise work on your project. When you are ready to test, click Build Execute Program. The first time you compile and execute a program, Kdevelop automatically runs automake to create the configure script and Makefiles for your project. Even if you don't change any code, the default template should compile and run without any problems. In the case of a console application, the code execution takes place in a panel that opens along the bottom of the main window. Graphical applications open a new window. Even the default KDE template provides file open and file save dialogs and a number of features (Figure 3-6).

Figure 3-6. Kdevelop "Hello World" application
figs/kph_0306.gif

Kdevelop also comes with a nice debugging environment that lets you set breakpoints in your code, and then step through execution so you can test out specific parts of your program.

All of the project development can occur with your default user , which means you can easily save projects to removable media, such as a USB drive, and then boot Knoppix on a different machine and resume development. Even if Kdevelop isn't your style, you can still use one of the many text editors Knoppix provides and take your programming projects with you.

 < Day Day Up > 


Knoppix Hacks. 100 Tips and Tricks
Knoppix Hacks. 100 Tips and Tricks
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net