Using Anjuta to Create GNOME Applications


Anjuta is a relatively new tool to help create GTK+ and GNOME applications with C and C++. It works with the Glade-2 GUI generator for GTK/GNOME and other packages to create nice-looking GNOME applications. As we saw with KDevelop, writing a Hello World application here won't require us to write any code. We'll get a sense though of how an application can be written in Anjuta.

You can install Anjuta with YaST, but the package dependency information is incomplete, so it does not install all the packages it needs. To be safe, try installing the -devel packages in the YaST Development libraries. Under Install and Remove Software, click the Package Groups display from the drop-down menu at the top. Go to Development, Libraries, GNOME. Many packages there will be called <PackageName>-devel. These packages contain all the necessary files to create (that is, develop) new programs.

When you open Anjuta, you have the choice of creating a new project, importing an existing project, or opening an existing Anjuta project or file. Click the Application Wizard button to begin a new project, and the screen shown in Figure 28.5 appears.

Figure 28.5. Select a new project type in the first screen.


In the second screen (see Figure 28.6), you select the name of the project and the language to be used. Project names are one word and are duplicated in the Project Target box.

Figure 28.6. In Anjuta, project names are one word, and you can code in both C and C++.


The third screen asks you to describe your project. You can be pretty long-winded if you choose. In the final settings screen (see Figure 28.7), you set up where to put your program in the GNOME menu, as well as several other items. Enabling gettext support allows you to internationalize your application with other human languages. You may also specify an icon for your application if you want it to appear in the GNOME Application menu.

Figure 28.7. Make final adjustments and choose an icon in the project settings here.


Confirm the settings you want the project to have and apply them to generate Yet Another Hello World program. Anjuta now runs its own Autogen program, which generates a configure file based on the wizard settings (see Figure 28.8).

Figure 28.8. When Anjuta generates source code, you still must compile, build, and execute the code.


After Anjuta has generated the source code and a configure script, you must compile and build the application before you can run it. Go to the Build menu and select Compile. You should not get any errors. Then go back to the Build menu and select Build All. After the application has been compiled and built, from the same menu, select Execute. You should see a terminal pop open with "Hello World!" and instructions on how to close the window.



SUSE Linux 10 Unleashed
SUSE Linux 10.0 Unleashed
ISBN: 0672327260
EAN: 2147483647
Year: 2003
Pages: 332

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