Выбрать главу

Graphical Development Tools

Fedora includes a number of graphical prototyping and development environments for use during X sessions. If you want to build client software for KDE or GNOME, you might find the KDevelop and Glade programs extremely helpful. You can use each of these programs to build graphical frameworks for interactive windowing clients, and you can use each of them to automatically generate the necessary skeleton of code needed to support a custom interface for your program.

Using the KDevelop Client

You can launch the KDevelop client (shown in Figure 28.1) from the desktop panel's start menu's Extras, Programming menu item or from the command line of a terminal window, like this:

$ kdevelop &

After you press Enter, the KDevelop Setup Wizard runs, and you are taken through several short wizard dialogs that set up and ensure a stable build environment. You must then run kdevelop again (either from the command line or by clicking its menu item under the desktop panel's Programming menu). You will then see the main KDevelop window and can start your project by selecting KDevelop's Project menu and clicking the New menu item.

FIGURE 28.1 KDE's KDevelop is a rapid prototyping and client-building tool for use with Linux.

You can begin building your project by stepping through the wizard dialogs. When you click the Create button, KDevelop automatically generates all the files that are normally found in a KDE client source directory (including the configure script, which checks dependencies and builds the client's makefile). To test your client, you can either first click the Build menu's Make menu item (or press F8) or just click the Execute menu item (or press F9), and the client is built automatically. You can use KDevelop to create KDE clients, plug-ins for the konqueror browser, KDE kicker panel applets, KDE desktop themes, Qt library-based clients, and even programs for GNOME.

The Glade Client for Developing in GNOME

If you prefer to use GNOME and its development tools, the Glade GTK+ GUI builder can save you time and effort when building a basic skeleton for a program. You launch Glade from the desktop panel's Programming menu.

When you launch Glade, a directory named Projects is created in your home directory, and you see a main window, along with two floating palette and properties windows (see Figure 28.2, which shows a basic GNOME client with a calendar widget added to its main window). You can use Glade's File menu to save the blank project and then start building your client by clicking and adding user interface elements from the Palette window. For example, you can first click the Palette window's Gnome button and then click to create your new client's main window. A window with a menu and a toolbar appears — the basic framework for a new GNOME client!

FIGURE 28.2 Glade is 100% backward compatible, which means Glade 2 can read Glade 3 interfaces, and vice versa.

Related Fedora and Linux Commands

You will use many of these commands when programming in C and C++ for Linux:

► ar — The GNU archive development tool

► as — The GNU assembler

► autoconf — The GNU configuration script generator

► cervisia — A KDE client that provides a graphical interface to a CVS project

► cvs — An older project revision control system, now replaced by Subversion

► designer — Trolltech's graphical prototyping tool for use with Qt libraries and X

► gcc — The GNU C/C++ compiler system

► gdb — The GNU interactive debugger

► glade-3 — The GNOME graphical development environment for building GTK+ clients

► gprof — The GNU program profiler

► kdevelop — The KDE C/C++ graphical development environment for building KDE, GNOME, or terminal clients

► make — A GNU project management command

► patch — Larry Wall's source patching utility

► pmake — A BSD project management command

► splint — The C source file checker

► svn — The Subversion version control system

Reference

► http://www.trolltech.com/products/qt/tools.html — Trolltech's page for Qt Designer and a number of programming automation tools (including translators) that you can use with Fedora.

► http://glade.gnome.org — Home page for the Glade GNOME developer's tool.

► http://www.kdevelop.org — Site that hosts the KDevelop Project's latest versions of the KDE graphical development environment, KDevelop.

► Sams Teach Yourself C++ for Linux in 21 Days, by Jesse Liberty and David B. Horvath, Sams Publishing.

► C How to Program and C++ How to Program, both by Harvey M. Deitel and Paul J. Deitel, Deitel Associates.

► The Annotated C++ Reference Manual, by Margaret A. Ellis and Bjarne Stroustrup, ANSI Base Document.

► Programming in ANSI C, by Stephen G. Kochan, Sams Publishing.

CHAPTER 29

Mono

Although Microsoft intended it for Windows, Microsoft's .NET platform has grown to encompass many other operating systems. No, this isn't a rare sign of Microsoft letting customers choose which OS is best for them — instead, the spread of .NET is because of the Mono project, which is a free re-implementation of .NET available under the GPL license.

Because of the potential for patent complications, it took Red Hat a long time to incorporate Mono into Fedora, but it's here now and works just fine. What's more, Mono supports both C# and Visual Basic .NET, as well as the complete .NET 1.0 and 1.1 frameworks (and much of the 2.0 framework too), making it quick to learn and productive to use.

Why Use Mono?

Linux already has numerous programming languages avail able to it, so why bother with Mono and .NET? Here are my top five reasons:

► .NET is "compile once, run anywhere"; that means you can compile your code on Linux and run it on Windows, or the reverse.

► Mono supports C#, which is a C-like language with many improvements to help make it object-oriented and easier to use.

► .NET includes automatic garbage collection to remove the possibility of memory leaks.

► .NET uses comes with built-in security checks to ensure that buffer overflows and many types of exploits are a thing of the past.

► Mono uses a high-performance just-in-time compiler to optimize your code for the platform on which it's running. This lets you compile it on a 32-bit machine, then run it on a 64-bit machine and have the code dynamically re-compiled for maximum 64-bit performance.