+ All Categories
Home > Documents > Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. ·...

Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. ·...

Date post: 07-Aug-2021
Category:
Upload: others
View: 4 times
Download: 1 times
Share this document with a friend
65
Anjuta IDE Manual 1 Anjuta IDE Manual Copyright © 2001-2002 by Naba Kumar, Andy Piper, Biswapesh Chattopadhyay This is version 0.0.4 of the Anjuta IDE Manual Table of Contents Introduction Getting Familiar with Anjuta Starting Anjuta Menus Useful Shortcuts Toolbars Main Window File Operations Creating a New File and inserting texts Opening and Saving Files Editing Files Editor Margins Editor Guides Syntax highlighting Code folding Auto-formatting source code Symbol browser and Browsing Files Searching for and Replacing text in files Searching Searching and replacing Finding in Multiple Files and Folders Printing a file Compiling and Building Compiling and building programs Running and Testing Executing the program Setting Compiler Options Support for your program Include Paths Library Paths Libraries to link Defining Macros Compiler Warnings Code Optimization Other compiler settings Project Management Introduction to managing projects Creating a New Project Loading and Saving Projects Loading Projects Importing Projects
Transcript
Page 1: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

1

Anjuta IDE Manual Copyright © 2001-2002 by Naba Kumar, Andy Piper, Biswapesh Chattopadhyay

This is version 0.0.4 of the Anjuta IDE Manual

Table of Contents Introduction Getting Familiar with Anjuta

Starting Anjuta Menus Useful Shortcuts Toolbars Main Window

File Operations Creating a New File and inserting texts Opening and Saving Files Editing Files Editor Margins Editor Guides Syntax highlighting Code folding Auto-formatting source code Symbol browser and Browsing Files Searching for and Replacing text in files Searching Searching and replacing Finding in Multiple Files and Folders Printing a file

Compiling and Building Compiling and building programs

Running and Testing Executing the program

Setting Compiler Options Support for your program Include Paths Library Paths Libraries to link Defining Macros Compiler Warnings Code Optimization Other compiler settings

Project Management Introduction to managing projects Creating a New Project Loading and Saving Projects Loading Projects Importing Projects

Page 2: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

2

Saving Projects Adding and Removing Files Adding Files Removing Files Project Configuration Getting Project Information Managing Project Files Compiling, Building and Executing a Project Overview Compiling the source Building an executable Creating a distribution package Install Configure Auto generate Clean Clean All

Debugging Introduction to debugging Debugger Targets Starting and Stopping the Debugger Loading Executables Attaching to a Process Loading a Core file Execution Single stepping (step in) Single stepping (step over) Single stepping (step out) Run/Continue Stop Program Restart Program Breakpoints Adding or Setting Breakpoints Editing Breakpoints Deleting Breakpoints Enabling or Disabling Breakpoints Working with Expressions Evaluating expressions Expression Watch Local varables Varables tips Stack Trace Stack Window Setting the current frame Information about the current frame Updating Stack trace Others Kernel Signals CPU registers

Page 3: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

3

Dynamically loaded Libraries Interrupting the program

Preferences General Build

User-defined Tools Introduction Tools Examples

Authors License

Introduction Anjuta is a versatile Integrated Development Environment (IDE) for C and C++. It has been written for GTK+/GNOME, and features a number of advanced programming facilities. It is a graphical interface to the collection of command line programming tools available for Linux and UNIX systems. These are usually run via a text console, and can be unfriendly to use.

Anjuta is an effort to marry the flexibility and power of command line tools with the ease-of-use of the GNOME graphical user interface. It has been made as user-friendly as possible.

Page 4: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

4

Figure 1. Anjuta in action

Page 5: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

5

Please report any problems with Anjuta - this will help to improve the software, as well as helping the Open Source community.

Getting Familiar with Anjuta

Starting Anjuta To start Anjuta, open the GNOME Main Menu. Anjuta is found on the Development submenu. In RedHat 8.0 or later anjuta can be found in Extra submenu and then Programming submenu.

Figure 1. Anjuta application icon

Click on the Anjuta icon to start. The IDE (Integrated Development Environment) will open. Alternatively, anjuta can be started from a terminal by issuing the command anjuta. If anjuta us started for the first time, it will greet you with a welcome message.

Menus At the top of the Anjuta main window is the menubar. Almost all of the functions are available by activating the appropriate menu item. The functions have been grouped according to their type. For example, the file operations have been grouped into the File menu.

The menubar can be detached. Drag it from the main window using the handle at the left. Once detached, it will become a floating window.

Figure 2. Menubar

Most of the menus and submenus can be detached. Click on the detach bar (the dashed line just above the first menu item). Once the menu is detached, it will become an independent window.

Page 6: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

6

Figure 3. File menu (detached)

Shortcut keys are available for many of the menu options. All of the shortcut keys are shown alongside the corresponding menu items. A useful reference to the shortcut keys which are not directly attachted with the menu is also available in the next section.

Useful Shortcuts • Switch Editor page: CTRL-TAB (forward) and CTRL-SHIFT-TAB (backward)

-- The pages could also be switched by right clicking on the notebook tabs and selecting an editor tab (useful when all the tabs in the editor are not visible at once). Some desktop configuration may already have these shortcut keys assigned. In that case, you will need to reconfigure them (not in anjuta, because they are fixed) if you want to avail these shortcuts.

• Context Help: CTRL-H -- Keep the cursor on the word (for example, the function name) for which you want to get the API help and press the shortcut. Context help only works if you have DevHelp installed. If you do not have DevHelp installed, the context help menu and toolbar button will be inactive. You can get it from DevHelp website. You will also have to install the related DevHelp books.

Page 7: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

7

• Auto complete: CTRL-ENTER -- Press the shortcut with the cursor placed at the end of incomplete word and a list of words matching the remaining part will appear. Scroll and select the right word from the list if you find one.

• More shortcus: Look for the shortcut keys displayed on right side of the menu item labels. They could also be changed as explained in the tip below.

Customize shortcuts

You can change the default shortcuts by hovering the mouse over the menu item and pressing the new key combination. Those shortcuts which do not have corrosponding menu items can not be changed.

Toolbars The operations which used most often are made available from the toolbars. There are five toolbars on the main window.

• Main Toolbar - file and editing functions • Extended Toolbar - project and build functions • Debug Toolbar - controls for the debugger • Browser Toolbar - browse bookmarks and function tags • Format Toolbar - text and code formatting functions

Figure 4. Main toolbar (detached)

Move the mouse pointer over any toolbar button. A tooltip describing the function of the button will appear.

There are some drop-down combination boxes on the toolbars. These are explained in later sections of the manual.

Main Window In the main window, there are three frames that you ought to be familiar with before you start doing anything (although some of them may not be visible when you start Anjuta). These are:

• Editor window • Project window • Message window

Page 8: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

8

The frame on the left is the Project window, at the right is the Editor window and the one at the bottom is the Message window.

The Project window and the Message window can be detached into separate windows, instead of docking them into the main window. You can detach them by clicking on the detach button (you will find them along with the frames: the small buttons with the un-docking icon). Similarly, you can hide them by clicking on the hide buttons (the small buttons with the red cross). You can make them visible at any time by choosing the menu items View->Project Listing and View->Messages, or by clicking on the corresponding toolbar buttons.

1. The Editor window is part of the main window, so it cannot be detached or hidden. However, you can always detach the individual documents, which are shown as pages in the Editor window. The Editor window will have one document active at a time (if there are any files opened). All of the file commands will apply to this active document. You can switch to any page by clicking on the page tab. You can do the same by right-clicking on the page tabs and choosing the document from the pop-up menu that will appear. This is especially useful when you have a lot of files opened, but not all of them are visible in the page tab area.

2. The Project window shows a tree of the project files if you have a project opened. Otherwise, the Project window is usually hidden. Double-clicking on any item in the Project window will open that file.

3. The Message window will list all the messages (both stdout and stderr outputs) when an external command is executed. The Message window is usually hidden, but appears as soon as an external command is executed, such as during file or project compilation, debugging sessions, searches, and many other operations. Anjuta also adds its own messages here when necessary.

The colors used to display the messages are important. Messages displayed in the standard foreground color (usually Black) are normal messages. Those displayed in Blue are important messages such as errors or other information. Messages shown in Red are Hot Linked. Double-clicking on such a message will take you to the particular file and line number specified in the message.

For example, when you compile a file which contains bugs, some red messages will appear showing what the problems are, and where they occur. Double-clicking on such messages will open the file and highlight the line containing the error.

Detacting Frames

All three frames are resizable and detachable. Try adjusting them by dragging the edges (handles) which separate them. To detach, click on the detach button at the top corner of the windows.

Session management

All of the settings, including the window sizes and window positions, are saved

Page 9: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

9

when you exit Anjuta. Session management is still under development, so you should not exit Anjuta with any unsaved documents. Anjuta will display a warning if you try to exit with unsaved documents still open.

File Operations

Creating a New File and inserting texts To create a new file, choose File->New from the menubar, or click on the New File button on the toolbar. A new page will appear in the editor (or a new window if the parent document is windowed). This new document will be named newfile#1, newfile#2, newfile#3 and so on.

Anjuta occatinally also creates new files during some operations. For example, some CVS operations, such as diff, file log, file status etc, create new files and add the output there. These could be saved in real file just like normal new files.

To insert popular text bits in the file, place the cursor at the insertion point and select the right insert text menu item from File->Insert Text. Some of the text bits use the user information (such as name and email) provided in Preferences (General page). So make sure you set them to correct values before inserting texts.

Save file

You should save new documents as soon as possible to avoid any data loss in case of a crash.

Opening and Saving Files 1. Opening a file: To open an existing file, choose File->Open from the menubar,

click on the Open button on the toolbar, or press Ctrl-O. This will display the Open File dialog.

Page 10: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

10

Figure 1. Open File dialog

Select or enter the file you want to open, then click OK. To open more than one file at once, select multiple files to open by first pressing CTRL and clicking the files in the list and press OK. If you change your mind, click Cancel to dismiss the dialog without opening the file.

Pressing TAB in the selection entry box works as auto complete for the file path. It behaves just like the usual shell auto complete and could be very helpful when the filenames are too long to type. For selecting multiple files at once, select a file in the dialog and press CTRL once. This will bring the file selection dialog

Page 11: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

11

in multiple-select mode and multiple files could be selected from the list. Multiple file select mode is simlar to single file select mode, except that the file operation (for which the file selection was being done) will be performed for all the selected files.

Figure 2. Open Multiple File dialog

The Show Hidden, if switched on (pressed in), will make the hidden files (files starting with "."; visible in the file list. Depress it to make them hide. Anjuta fileselection dialog also has inbuild file type filter. Select the appropiate file type filter in the dialog and the file list will be limited to the files of the selected type only.

2. Saving a file: To save a file, choose File->Save from the menubar, click on the Save button on the toolbar, or press Ctrl-S. This will save the file. If the file is new, a Save As dialog will appear. Enter a filename and click OK to save the new file with the name supplied.

3. Saving a file with a different name: You can explicitly save a file with a new filename. To do this, choose File->Save As from the menubar. A Save As dialog

Page 12: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

12

will appear prompting you to enter the new filename. Enter the name and click OK.

File save as overwrite

When you use Save As with an existing file, the original is not deleted. It is left unchanged since the last save. If a file with the new filename already exists, a confirmation dialog will appear, to ensure that you want to overwrite it. Clicking Yes will overwrite the file with the file you are saving.

4. Closing a file: To close a file, choose File->Close from the menubar, or click on the Close button on the toolbar. The file could also be closed by clicking the cross in the filename tab. This will close the current file. If the file is not saved, or is a new file, then Anjuta will prompt you to save the file before closing it.

File auto save

If you have enabled auto-save, it will not auto-save any new files. You must first save them manually. The same applies to the Save All option: it will not save new files, if you haven't saved them first manually. You must save a file manually before auto-save or Save All will work with it.

Editing Files Anjuta has a number of helpful features which aid in editing and working with source files. The following sections describe how to use some of the interesting features available.

Editor Margins

Editor Margins: Editor margins are the small area on the left of the editor for some special purposes. There are three editor margins available and all of them may not be available when you first start anjuta. They are Line numbers margin, Markers margin and Code fold margin. By default (that is, when you run anjuta for the first time) only the code fold margin witll be visible. The rest could be made visible from View->Editor.

Page 13: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

13

Figure 3. Editor Margins

The Line Numbers Margin is lagest of all the three margins (and slightly darker then rest) and displays the document's line numbers. Line Number Margin could be made visible or invisible by toggling View->Editor->Line Numbers Margin. Single left clicking on this margin will select the whole line (including the last newline, if present). You can set the font properties for line number margin in the preferences.

Markers Margin is the next margin which can be made visible or invisible by selecting View->Editor->Markers Margin. This margin displays graphical icons to mark the give line. The markers which will be displayed in this margin are Bookmark marker (rectangular blue colored icon), Breakpoint marker (circular red colored) and Line indicator (pointed arrow yellow colored). Bookmark marker is used to indicate bookmaked lines which could be toggled from Bookmark->Toggle Bookmark with the cursor placed in that line. The breakpoint marker is used in debugger to mark the line with debugging breakpoints (see debugging section for more details). The line indicator marker is used to indicate a line when we do a jump from another part, for example when navigating the bookmarks and during single stepping in debugger.

Code folding margin is where the folding tree is visisble. Clicking on these folding tree nodes will fold or unfold the code blocks. An underline will also be drawn below the folded line to make it more obvious that a block of code has been folded below the line. For more details on code folding, see the section Code Folding below.

Invisible margin marker

If the marker margin is not visible, the markers will be displayed by changing the background colobreakpoint marker is set in a line and the marker margin is not visible, that line will be displayed bookmark marker and line indicatior marker, the background color of the line will be sky blue and yethis (perhaps due to some contrasting themes), enable the Markers Margins from View->Editor->M

Page 14: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

14

Figure 4. Editor markes when markers margin is invisible

Editor Guides

The editor could be made to make certain document information, which otherwise are normally not visible. Indentation guides, white spaces and line end characters are such information which could be made visible for editing comfort. They could be make visible or invisible by toggling the menu items in View->Editor. Indentation guides are the small dotted lines drawn to connect the matching braces in the source code. When the cursor is over one such maching braces, the dotted indentation guide is highlighted to give a visual region of the indentation.

Figure 5. Editor with guides

Syntax highlighting

Anjuta can highlight many different languages. This is usually done automatically by determining the type of the file from the file extension. If Anjuta cannot determine the type of the file, there will be no syntax highlighting. You can explicitly force a particular highlight style by selecting the style from the menu Format->Force Highlight Style.

Page 15: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

15

Code folding

Source files which have block coding properties (such as C, C++, Pascal, Java etc.), have the advantage of working with code folds. All of the code blocks in the source file can be folded or unfolded by clicking on the fold points in the fold margin of the Editor window (usually a +/- symbol or up/down arrow). These fold points automatically appear for source files which use code blocks.

Code folding is especially useful when editing big source files that run to thousands of lines. Once the folds are closed, the document appears to become smaller, facilitating easy browsing and editing of the file.

Auto-formatting source code

If the current file is a C or C++ source or header file, then it is possible to automatically indent (auto-format) the file. This gives a clean look to the source code, increases legibility, reduces the likelihood of syntax errors, and above all it saves time. This can be performed by clicking on the Auto-format button in the main toolbar or choosing Format->Auto-format on the menubar. Change the style of formatting by customizing the choices in the preferences.

Symbol browser and Browsing Files All C and C++ source and header files can be browsed using the tags in the files. All of the open C and C++ source and header files are scanned for available tags (a "tag" refers to a function definition, structure, macro, etc.). Please note that Tag and Symbol is used synonymously in this manual, except when refering to Tags browser and Symbol browser, which two different interfaces.

1. Tags Browser: Tags browser is available on the Browser toolbar. It shows a list of tags available in the currently active file (souce file). If there is no tags (or sysmbols) available in the file, the tags list will be invisible and a "No Tags" will be displayed instead. The tags in this list are shown along with the line numbers where they are found. If there are multiple symbols with the same name, they will be shown with different line numbers.

Figure 6. Tags toolbar

Function symbols

Function prototype and definition, if present in the same file, can be usually distinguished from the corrosponding line numbers. Prototypes

Page 16: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

16

usually comes before the definition, so they are likely to have smaller line numbers.

2. Symbol Browser: If there is a project open, Anjuta will scan for tags in all of the source and header files of the project. This way it is possible to go to any function definition, structure definition, class definition etc. without manually opening the file. You don't even have to know which file that tag is found in (except in the case of function definitions). The symbol browser lists all the available symbols in the project.

Figure 7. Tags toolbar

Tags synchronization

Page 17: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

17

You don't have to worry about the synchronization and update of the tag database. Anjuta will take care of everything. You just have to decide which tag you want to go to!

Searching for and Replacing text in files Searching

To search for a text or regular expression string in the current file, choose Edit->Find or press Alt-F. This will open the Find dialog.

Figure 8. Find Text dialog

Use the text box to specify the string to search for, and select whether it is a normal string or a regular expression (RegExp). It is also possible to specify the direction of search, whether the search is case-sensitive or not, and the scope of the search. Click OK to start searching.

If the search is successful, the matched text in the document will be highlighted and you will be taken to the line containing the match. If the search is not successful, a match not found message will be displayed.

If you want to search again, click on the Find button on the main toolbar. This will find the next match in the direction of the search. You can even change the search text when you do this. Enter the new string in the Find String text box in the main toolbar.

Page 18: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

18

Searching and replacing

Figure 9. Find and Replace dialog

Search and replace is similar to just finding text, except that you also specify the replace text in the Replace Text text box, and whether or not you want to be prompted before the replace takes place.

Finding in Multiple Files and Folders

Page 19: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

19

Figure 10. Find in files dialog

To find in files and/or folders, add all the files and/or folders you want to search in by entering their names in the text box and clicking on the Add button.

Remember, directories are searched recursively. All of the files under the directory, and the files under all the subdirectories, and the files under all of the sub-subdirectories (and so on) are all included in the search.

If you want to remove or edit an entry in the list, select it by clicking on the item. Click on Remove, or make changes in the text box and click on Update.

Clicking on Clear will clear all the entries.

Enter the text you want to search and specify whether the search should be case-sensitive. Click OK to start searching.

The search results will be listed in the message window. Double clicking on them will take you to the file and particular line number where the match has been found. The matching line is also highlighted.

Printing a file

Page 20: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

20

Print preview could be taken by selecting File->Print Preview. It will render the current file and present a preview of the print. Source codes which are hilighted in the editor are also highlighted similarly in the print (or preview). Addtional options are available to print with the line numbers, wrapped lines and/or headers in the print preferences from File->Page Setup.

Page 21: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

21

Page 22: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

22

Figure 11. Print preview of a C file

In the page setup (or print preferences), print margins, landscaped or portrait page layout and paper type could also be set. Remember to set them up properly according to your printer, otherwise printing may not come up properly.

Figure 12. Print Preferences

Page 23: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

23

When you are ready to print and satisfied with the preview, select File->Print or Print from the print preview window. This will bring up the actual print dialog as shown below. Select the appropriate print parameters and print the file with Print on it.

Figure 13. Print Dialog

Compiling and Building

Compiling and building programs Once you have written a C or C++ program, you will probably want to build and run it. To compile the current file (if it is a C/C++ source file), click on the Compile button in the extended toolbar, choose the menu item Build->Compile, or press F9. The Message window will appear and list all the messages including any compilation errors. You can double-click on the error lines (displayed in red) to go to the particular line where the error occurred. You can define macros, specify include paths, and set the compiler options if you so wish. Compiling a file will save it first, then it will be compiled.

Compiling a file does not build an executable. It simply generates an object (*.o) file which is later linked to build the executable.

Page 24: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

24

To build a file, click on the Build button in the extended toolbar, choose the menu item Build->Build, or press F10. This will again display the Message window listing all the messages that are encountered during the build. The build process will link your object file with libraries and generate the executable. You can specify the libraries to link with your file in the Compiler Options dialog (Settings->Compiler and Linker Settings …)

Build dependencies

The build process will compile your file first if the object file is not up-to-date or it has not yet been generated. This means that you can build a file without first compiling it. However, when you are dealing with a project rather then a single file, compiling and building are entirely different concepts.

Running and Testing

Executing the program Once your executable is ready after the build, you can execute it by clicking on the Execute button in the extended toolbar, choosing the menu item Build->Execute, or pressing F3.

Dependencies

Unlike the build stage, execution doesn't check for dependencies (at least for the time being). In other words, it does not check if the executable is up-to-date before it executes the program. So, you must take care of that yourself.

If you want to pass any arguments to your program, choose Build->Set Program params …, enter the arguments in the dialog that appears (shown below) and click OK. You can also specify whether the program should be run in a terminal or not.

Figure 1. Setting program parameters

Page 25: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

25

Setting Compiler Options You can customize the the way the compiler will compile your file or project. Remember, each project will have its own set of compiler settings. If the options are modified when there is no project open, the settings are saved separately and will be used when compiling and building single files only. These are all transparent to the user: Anjuta handles them automatically.

Support for your program You have have seen in the previous sections how to specify basic compile options (such as include and library paths, linker settings, and so on). This process can be cumbersome when you want to use some of the more standard or popular libraries — GTK and GNOME, for example. To enable easy implementation of these libraries and to avoid and inconsistencies, the developers of such libraries usually supply a configuration program (usually called *-config) along with their libraries.

Well, that's the theory. Now for the practical part. Anjuta will do the difficult parts for you, so you do not need to worry about the configuration programs for these libraries — just add the particular support to your project.

To add support for a library to your program:

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Supports tab in the Compiler Options dialog.

2. Select the supports for your program by double-clicking on them. 3. Double-clicking again on any selected supports will unselect them.

Page 26: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

26

Figure 1. Supports dialog

This will automatically set all the include paths and the libraries necessary for the options chosen. There will be no need to set the include paths and libraries manually.

Available supports

Currently, Anjuta has only a few library support options — Glib, GTK, GNOME and Bonobo. Some of these are not yet fully supported.

Compiler options for supports

Once basic library supports have been specified, there is no need to manually set the basic compiler options usually required for these libraries. Any other libraries may still need compiler settings to be changed.

Include Paths

Page 27: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

27

To set include paths for your program:

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Include Paths tab in the Compiler Options dialog.

2. Enter each of the paths one by one and click on the Add button for each entry. 3. To remove an entry, select the entry in the list and click on Remove. 4. To edit an entry, select the entry, modify it in the text box and click on Update 5. To clear all of the entries, click on Clear.

Figure 2. Include Paths dialog

Absolute or Relative include paths?

If the settings are for a project, then all include paths should be relative to the source directory of the project. Avoid using absolute paths — otherwise, when you distribute the source code, other people will have problems trying to build the program.

If the settings are are made outside of a project, then it doesn't matter whether the paths are absolute or relative — the settings will be local to your machine only.

Library Paths When your program links to external libraries (specified via the Libraries settings in the next section), the linker will search for those libraries in the library search paths.

Page 28: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

28

Anjuta will automatically use system library paths, but you should add any additional search paths to your project.

To set library paths for your program:

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Library Paths tab in the Compiler Options dialog.

2. Enter each of the paths one by one and click on the Add button for each entry. 3. To remove an entry, select the entry in the list and click on Remove. 4. To edit an entry, select the entry, modify it in the text box and click on Update 5. To clear all of the entries, click on Clear.

Figure 3. Library Paths dialog

Absolute or Relative include paths?

If the settings are for a project, then all library paths should be relative to the source directory of the project. Avoid using absolute paths — otherwise, when you distribute the source code, other people will have problems trying to build the

Page 29: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

29

program.

If the settings are are made outside of a project, then it doesn't matter whether the paths are absolute or relative — the settings will be local to your machine only.

Libraries to link Libraries are external modules that must be linked with your program at the final stage of the build, to produce another library or an executable. The linker is passed the list of libraries to link with to construct the final target.

It is also possible to provide the names of object modules (*.o files) along with the libraries to link against. Object modules are specified by a special flag (asterisk *) at the start of the object module name (so that Anjuta can differentiate them from the library modules). Object modules must be listed with their full paths (absolute or relative, depending upon the context), because they will not be searched for on the library search path.

Example: in the screenshot below, the first entry "scintilla" is a library, while those starting with "*" are object modules.

Figure 4. Libraries dialog

Page 30: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

30

Libraries follow the naming format: libXXX.a. When specifying libraries in the list, the prefix "lib" and the suffix ".a" are skipped, and only the library name "XXX" is given in the entry.

To set libraries for your program:

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Libraries tab in the Compiler Options dialog.

2. Enter each of the library names (and object names, if required) and click on the Add button for each entry.

Libraries can also be selected from the list shown in the right pane of the dialog. Not all libraries will be available in this list.

Object module paths

Object modules must be specified with an explicit path and must start with an asterisk (*). Explicit path means the path should be relative path of the object from the source dir and the filename should be complete (eg. ../../lib/diagram.o).

3. To remove an entry, select the entry in the list and click on Remove. 4. To disable an entry, double-click on the entry in the list. To re-enable it, double-

click again.

Entries that are disabled are not included in the the linking process.

5. To edit an entry, select the entry, modify it in the text box and click on Update 6. To clear all of the entries, click on Clear.

Defining Macros To define macros for your program:

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Defines tab in the Compiler Options dialog.

2. Enter each macro to define one by one and click on the Add button for each entry.

3. To remove an entry, select the entry in the list and click on Remove. 4. To edit an entry, select the entry, modify it in the text box and click on Update 5. To clear all of the entries, click on Clear.

Page 31: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

31

Figure 5. Defines dialog

Compiler Warnings It is possible to tell the compiler how to respond to each different type of warning.

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Warnings tab in the Compiler Options dialog.

2. Select the warnings you want to see in the Message window when you compile or build your file or project.

3. Selecting No Warnings will disable all warnings. 4. Similarly, selecting All Warnings will enable all warnings.

Page 32: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

32

Figure 6. Warnings dialog

Code Optimization To set the level of Optimization for code compilation:

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Optimization tab in the Compiler Options dialog.

2. Select the level of optimization required.

Page 33: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

33

Figure 7. Optimization dialog

Note that it is not a good idea to enable any sort of optimization if you have also enabled debugging. It will not do any harm to do so, but it will make life much more difficult when debugging the program. With optimization enabled, the compiler will modify your code to improve performance. This sometimes creates confusion during debugging, as the line number that the debugger refers to will not always correspond to the actual line number in the source file.

Code optimization takes place during the compilation stage only, and does not affect the source code in the file.

Other compiler settings To set miscellaneous compiler settings:

1. Choose the menu item Settings->Compiler and Linker Settings … and click on the Others tab in the Compiler Options dialog.

2. Various options for compiling are set on this tabbed section.

Page 34: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

34

Figure 8. Other Compiler Settings dialog

The first is the Enable Debugging option. This option tells the compiler to add extra debug information (such as the symbol table), which is necessary for stepping through the code. This makes the program slightly larger.

This option will be most useful during the development of your program. When the code is ready for the release, disable this option and build the program again. The project should be cleaned first before the rebuild — otherwise, due to automatic dependency checking, not all of the files may be built with this option disabled.

Note that it is not a good idea to enable any sort of optimization if you have also enabled debugging. It will not do any harm to do so, but it will make life much more difficult when debugging the program. With optimization enabled, the compiler will modify your code to improve performance. This sometimes creates confusion during debugging, as the line number that the debugger refers to will not always correspond to the actual line number in the source file.

The second option Enable Profiling is similar to the Enable Debugging option, except that it builds your program with profiling information. Profiling is not yet implemented in Anjuta. For the time being, you can use gprof, a console-based profiler; or MemProf, which is a GUI (GTK) application. Read the gprof manual page to learn how to profile your program. Enabling profiling will make a progam run very slowly, so it should only be used for debugging.

Page 35: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

35

Additional options to pass to the compiler and linker can be entered into the text boxes on this tabbed section.

Project Management

Introduction to managing projects If the program or application you are developing is a small one, and it is only going to be run on your computer, then a single source file will often serve the purpose. If the application is more complex, with multiple source files, it is useful to be able to keep track of your program and its resources. Such a program becomes a project.

Many command-line tools are available to maintain and manage a project, and each tool has its own specific rules and capabilities. Do not worry — Anjuta will take care of everything.

It is still possible to make use of other tools, which has the added advantage of making your project more flexible and more adaptable. However, before you start editing all those makefiles, bear in mind the files that Anjuta manages. These files will all be overwritten.

If you do not want to get involved with manually editing project files, just relax and let Anjuta do it all.

Creating a New Project Choose the menu item File->New Project … to start the application wizard. Read the first page carefully. Click on Next to proceed.

Select the type of application you want to create in the second page. Click on Next to proceed.

On the third page, enter all the necessary details for your project. You cannot change these settings later. No white spaces or any non-alphanumeric characters, except underscore (_) and dash (-), are allowed in any of the entry boxes in this page (except the Author text box). You should also select the Programming language which should be used for the initial project generation. Only C and C++ are supported at the moment. Finally, click on Next to proceed.

Enter a short description of your project on the fourth page. Click on Next to proceed.

On the fifth page, specify whether your project will have internationalization support using gettext (read the gettext info page for more details). This gives your project multilingual support for different regional languages such as English, French, Dutch etc.. The rest of the options are for setting whether the GNU copyright statement should

Page 36: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

36

appear in the comments at the top of each file, and enabling GNOME desktop menu information if necessary. Click on Next to proceed.

The final step is to verify the information you have just supplied. Click on Finish to start generating the project.

Once project generation is over, you can try it out by building the project and executing it.

Loading and Saving Projects Loading Projects

To open a project, choose the menu item File->Open Project …. Select the project file (*.prj) in the dialog and click OK.

If the project has recently been opened, then you will find it listed in the menu File->Recent Projects. Choose the project file from the list, and the project will be opened.

As soon as a project is opened, Anjuta will enter Project mode. There are three panes in the project window. The first is the project pane and lists the project files organized in file types. The second is the symbol browser, which has already been discussed in section Symbol Browser and tags Brwoser. The third pane is the file view of the project and is more or less similar to a mini file-manager. In file view, all the files present in the project tree is visible. Right clicking on these files will pop up the file operation submenu.

If the project is also a CVS tree, then corrosponing file revision numbers are also listing on the right of file names in the file view pane.

Importing Projects

The import project feature is used to import an already existing project and convert it into anjuta projcect. Activate the import project wizard from File->Import project and follow instructions dictated by the wizard. Once the project is imported, it could be opened in anjuta subsequently just like any other anjuta project.

Saving Projects

To save the current project, choose the menu item File->Save Project or click on the Save Project button on the Extended toolbar. When a project is saved, only the files that need to be updated are actually written to disk, to avoid breaking any unnecessary dependencies.

Any build files that are flagged Disable Overwriting in the project configuration will also not be touched.

Page 37: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

37

Adding and Removing Files There are various different types of file that Anjuta will manage for you in the project:

1. Source files 2. Document files 3. Pixmap files 4. Help files 5. Data files 6. PO files

Each of these different types exist in their own specific directories inside the project.

Adding Files

Choose the corresponding menu item from the Project->Import File submenu, or right-click on the project in the Project Listing and select the type of file from the Import File submenu on the Operations popup menu. Select the file you want to add in the dialog and click OK.

If the file you choose has already been added to the project, then Anjuta will not add it again. It will also give you a warning that the file is already added.

If the file you choose is not in the directory corresponding to the type you have selected, you will be asked to confirm that you wish to copy the file into that directory. Anjuta cannot add files which are outside of their correct directories.

Removing Files

To remove a file from the project, select the file you want to remove from the Project Listing, right-click to open the Operation popup menu and choose Remove.

A confirmation dialog will appear, and the file will be removed from the project.

The file is not deleted!

The file is not deleted from the filesystem. It still exists, and you can add it back again later if you so wish. The file is only removed from the project listing, and will not take part in any of the project operations such as compiling, building, distribution etc..

Project Configuration Projects created by the wizard are further customizable. During the course of your project development, you are likely to add more features and more codes which will

Page 38: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

38

require new configuration setup. Goto Project-> Project Configuration to bring up the configuration dialog.

1. Descriptoin: This page contains the short descrption of your project which was provided during the project creation. Description of the project could be updated from here.

2. Build files: Some of the project's build files are managed by anjuta by default. These files are configure.in and various Makefile.am of the project. If you need to manually edit these files, disable them from being overwritten by anjuta. They could be disabled from overwriting by selecting the check boxes against them. Once that is done, anjuta will no longer overwrite them and hence you can freely edit those files.

3. Configuration scripts: Configure.in file, which could be found in the top level project directory, contains autoconf macros and scripts for configuring your application. You can provide additional scripts here for testing, setting macro variable etc. for your project. This would require you to have enough knowledge of autoconf/automake and to code them properly.

4. Extra Modules:Application wizard creates only a set of most common directories for your project. If you later wish to add more directories (for example when your project becomes bigger), you can specify the sub-directories here. These subdirectories will be made part of your project and their Makefiles will be configured when the project is configured. The sub-directory names should be space sapareted in the list. Two lists could be formed. First one will be build before src directory and second one will be build after the src directory. One important thing to note here is that anjuta will not manage the Makefile.am files in these sub-directories. You will have to keep them updated yourself.

5. Top level Makefile: Occationally, we need to provide additional make rules and other additional stuff in the top level Makefile.am (found in the top level directory) of the project. You can provide those codes here and anjuta will append them to the Makefile.am after it is updated.

Updating project version

Currently, there is no easy way to set a version number to your project direcly through an interface. (wizard creates your project with 0.1 version). The next best thing you can to do is: Make sure the project is not open in anjuta, open the *.prj file of your project and edit the project.version propery. Save the project file and open it in anjuta. Save the project again from anjuta. You project version should now have bumped to the new value.

Getting Project Information To display the information for the current project, choose Project->Project Information. A dialog will appear displaying various details about the project generation options.

Page 39: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

39

Figure 1. Project Information dialog

Managing Project Files This section details some of the more advanced information about the management of project files. If you do not want to know about low-level specifics, feel free to skip this section.

Anjuta will manage the following files of a project:

1. Project file --> [ *.prj file ] 2. Top level configure.in --> [ configure.in ] 3. Top level Makefile.am --> [ Makefile.am ] 4. Source Makefile.am --> [ Makefile.am in the src subdirectory ] 5. Document Makefile.am --> [ Makefile.am in the doc subdirectory ] 6. Help Makefile.am --> [ Makefile.am in the help subdirectory ] 7. Data Makefile.am --> [ Makefile.am in the data subdirectory ] 8. Pixmaps Makefile.am --> [ Makefile.am in the pixmaps subdirectory ] 9. POTFILE.in --> [ POTFILE.in the po subdirectory ]

If you are doing your own work on the build files for an individual project, then you should avoid conflicting with what Anjuta does. It is recommended that these files should not be touched.

If you wish to modify these files, choose Project->Project Configuration … from the menubar, and disable the overwrite option for each of them on the Build files tabbed page.

Page 40: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

40

You can also create your own subdirectories in the project. Managing build files in these directories is solely your job.

If your project has multiple executables, then do not mix them with the main executable for the project in the source directory. Create separate directories for them. Again, it is your job to manage them.

Enure that you add modules in to accommodate the subdirectories you have created. To do so, choose Project->Project Configuration … from the menubar, and add the module information on the Modules tabbed page.

Compiling, Building and Executing a Project Overview

An executable for a project is generated in two steps:

1. Compiling 2. Linking

These steps are collectively known as Building. Some other steps may also be involved in the build process, but for the sake of simplicity, we will only look at these two steps.

Compiling is the step in which object files are generated from their corresponding source files. For instance, a source file hello.c will generate hello.o after compilation. Usually you do not need to worry about these object files — just think of them as intermediate files involved in creating the final executable.

Once the object files (*.o files) are ready, they are all linked together (along with any libraries) to generate the final executable. This step is called Linking.

Compiling the source

In a project, the individual source files can be compiled separately into objects (*.o files). Although you do not have to worry about these object files, sometimes it is handy to compile a file first (for example, to make sure there are no syntax errors). Building a whole project can take a lot of time, especially in the case of larger and more complex applications. Therefore, you will probably go through a series of edit-compile-edit-compile-.... loops while a developing the project.

To compile a file, choose the menu item Build->Compile or click on the Compile icon on the extended toolbar. This will compile the active file.

Page 41: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

41

Building an executable

Anjuta has no separate link command, simply because it is not necessary. The build process will compile all the source files and link them together along with the libraries. The build command will note recompile those files which are already up-to-date (this is called the dependency check). If you have already compiled all of the files individually, then the only thing the build step performs is the link. If you have already built the project and no dependent file has been modified, even the link stage will be skipped.

So how exactly does the dependency check influence the project development? If you have modified a file, then all of the source files that depend on the modified file are recompiled. All files (not only the object files and executable) in the project are checked for these dependencies during the build process. If it is found that a particular file is dependent on some other file which has been modified, then that file will be re-generated.

Since you have now got a rough understanding of the value of the dependency check, can you imagine how your life (as a programmer) would be if it had not been there? If you cannot answer just yet, then will find out when you start developing big projects!

Build->Build will build all of the files in the src (source) directory, and generate the executable. Build->Build All will build the whole project — all of the subdirectories (including src), are built recursively.

Creating a distribution package

To build the tarball distribution of the project choose Build->Build Distribution. This will create a tarball (*.tar.gz) and put it in the top level project directory. Copy the file to a safe place for distribution.

Install

Choosing the menu item Build->Install will install the generated application on your system.

System wide installation

You must be logged in as root to perform a system-wide install. Also note that for a GNOME application to use the pixmaps in the project, it must be installed as a system-wide application. Otherwise, when the application is executed in your project, there will be lots of "pixmap not found" errors.

Configure

To run the configure script found in the top level project directory, choose the menu item Build->Configure. The script will determine the system configuration and create some of the files required to perform a build (such as Makefile and config.h). This is

Page 42: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

42

necessary because the application may depend on specific configuration of some of these options.

When to configure

Until you run configure, you cannot start building the project.

The configure script is (usually) run only once at the beginning of the first build process — for example, just after you have extracted a source tarball of a project distribution. After that, configuration is automatically handled by the subsequent build processes. If you have used the Application Wizard to create the application, then you will not need to run configure separately: the wizard will run it as a part of the project generation process.

You can also supply additional options to the configuration script. After choosing the Configure menu item, a dialog will appear to prompt for additional options.

Figure 2. Configure options dialog

Enter any options (or leave it blank to accept the defaults) and click OK. To find out the options available to the configure script, enter --help in the option entry box and click OK. The options will be displayed in the Message window.

There is no requirement to run configure only once. It can be run at any time, usually when the configuration options need to be changed. One thing to note is that, if the config.h file in the top level directory is changed, running configure again will not overwrite it.

Auto generate

Auto generation consists of two steps: running automake and then running autoconf. If an executable autogen.sh script is found in the top level project directory, this file will be executed instead of the two steps. Like configuration, auto generation is

Page 43: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

43

automatically handled by the build process. It can also be run in cases where it is difficult to configure the project (such as lots of errors reported due to mis-synchronization after modifying lots of build files).

When to autogen.sh

Unlike configuration, auto generation does not need to be run even once — in fact, it does not need to be run at all! The option is available because it can be handy in some circumstances.

Choose the menu item Build->Auto generate to auto generate the project.

Read the info pages of automake and autoconf for more details on how these tools work.

Clean

This option cleans the project and leaves it in a state that requires Build All to be performed. It deletes all of the files generated by the build process, including all object files (*.o files) and the executable(s) in the src directory (and other directories).

Choose the menu item Build->Clean to clean the project.

Clean All

There is not a great deal to say about Clean All (which might also be called Clean distribution, or clean dist for short). It cleans the project and leaves it in a state that requires Configure and Build All to be performed. It deletes all of the files generated by the build processes, including all the object files (*.o files), executable(s) and Makefiles. In other words, it leaves the project as though it has just been extracted from a distribution tarball.

Choose the menu item Build->Clean All to completely clean the project.

Debugging

Introduction to debugging To debug is human. To fix it is divine...

Well, the human part is what this section is about. The divine part is up to you!

When a program does not behave in the way it is supposed to, we say the program contains a bug or bugs. This does not refer to compilation errors — those are simply errors and they are relatively easy to clear, because the compiler tells you where the

Page 44: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

44

problems are. On the other hand, bugs are errors that happen during the execution of the program and they can be hard (sometimes very hard!) to detect.

Any program that you think is bug-free is never completely bug-free. All we can try to do is to reduce the number of bugs contained in the program. The process of removing bugs is known as debugging, and the tool that is used for debugging is called the debugger. Anjuta provides a very user-friendly and powerful debugging environment (actually, a GUI wrapper over gdb, a powerful command line debugging tool).

A debugger tracks and traces the execution of the program and provides various views of information needed to study the execution of the program.

Debugger Targets

Before debugging, it is important to understand what debugging targets are. Debugging targets refer to those entities with which the debugger interacts during operation. There are four types of debugging targets:

1. Executable 2. Symbol table 3. Core file 4. Process

There can be only one target active for each of the four types of targets at any give time. All of the targets do not need to be active for the debugger to work, although certain combinations are required active for a useful debugging session. Example combinations may be [ executable, symbol table, and process ] or [ executable, symbol table and core file ].

The target Executable becomes active when an executable file is loaded into the debugger.

The target Symbol table is automatically loaded from the executable file, therefore it does not have to be handled separately. The symbol table is necessary for the debugger to identify the various symbols in the source code of the program. The information is included in the executable during the compilation (as long as the program is compiled with the Debug option enabled — see the chapter called Setting Compiler Options> for details).

The target Core file becomes active when the core file is loaded into the debugger. A core file is the memory image of the program which was dumped by the kernel, usually because it had performed an illegal operation. The core file can provide information such as variable contents, register values, and stack trace of the program at the time of the error. By studying the core file it is possible to find out which part of the program has misbehaved and resulted in the core dump.

The target Process becomes active when the program is executed under the debugger or when you attach to an already running process.

Page 45: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

45

Starting and Stopping the Debugger

To start the debugger, choose the menu item Debug->Start Debugger. This will start the debugger with the executable of the current project. If there is no project open, then it will load the executable of the currently active file. If there is no project open, and no active file, the debugger will start, but no executable will be loaded. The executable will have to be loaded manually.

Once the debugger is started, a debugging session will be entered. When debugging is complete, exit the debugging session by choosing the menu item Debug->Stop Debugger.

Loading Executables

The debugger will automatically load an executable if a project or a file is currently open. To load a different executable, choose the menu item Debug->Load Executable …. A file selection dialog will open. Select the executable to debug and click on OK.

Attaching to a Process

It is possible to attach to a running process for debugging. Choose the menu item Debug->Attach to Process …. A list of all the process running on the system will appear.

Figure 1. Attach to Process dialog

Select the process to attach to and click OK. Ensure that the executable (and hence the symbol table) have already been loaded into the debugger.

Page 46: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

46

If lots of question marks (??) appear during the debugging session, then the attached process and the executable do not match.

Loading a Core file

Choose the menu item Debug->Load Core file … to load the core file. Select the core file in the file selection dialog and click OK. When loading a core file, ensure that the executable file (and hence the symbol table) has already been loaded — otherwise, debugging may be tricky!

If lots of question marks (??) appear during the debugging session, then the core file and the executable do not match.

Execution Execution of a program in the debugger can be finely controlled. The program can be executed in single steps, or allowed to continue until it encounters a breakpoint. Executing like this is essential for tracking program behaviour. Like a video editing session, the program can be executed in slow motion with the ability to go forward, pause, stop, and so on.

The methods that can be used to execute a program in the debugger are described in the next few sections.

Single stepping (step in)

Single stepping executes only one statement of the program (from the place where it has stopped) and then returns control. If the statement that is executed contains one or more functions, the debugger tries to step inside the functions (in the sequence in which the functions are executed). Once the statement is executed and control is passed back, it is possible to study the various program parameters.

If the program has not been started at the time single stepping is started, the program will be started and will be stopped at the first statement of the program (the first statement in the function main()).

Choose the menu item Debug->Execution->Step In or click on the Step In icon in the Debug toolbar to step into a program.

Single stepping (step over)

Step over is similar to step in, except that it does not step inside any function in the statement being executed. The statement will be executed in one go.

Choose the menu item Debug->Execution->Step Over or click on the Step Over icon in the Debug toolbar to step over statements in a program.

Page 47: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

47

Single stepping (step out)

Step out will execute the current function until it returns. The program will be stopped once it exits from the function. Step out is not really single stepping, because it does not only execute a single statement — it executes the whole function until that function returns to the calling function.

Choose the menu item Debug->Execution->Step Out or click on the Step Out icon in the Debug toolbar to step out in a program.

Run/Continue

This option will continue the execution of the program until a breakpoint is encountered, or the program exits.

If the program is not yet started, then the program will be started and executed until a breakpoint or program termination is reached.

Choose the menu item Debug->Execution->Run/Continue or click on the Run/Continue icon in the Debug toolbar to continue the execution of a program.

Stop Program

This option will kill the program which is being debugged. Note that it is not possible to stop an attached process.

Choose the menu item Debug->Stop Program or click on the Stop Program icon in the Debug toolbar to terminate the execution of a program.

Restart Program

This option will stop the program and then restart it. All of the breakpoints will remain in effect. Note that it is not possible to restart an attached process.

Choose the menu item Debug->Restart Program to restart the execution of a program

Breakpoints When debugging a program, it is useful to be able to stop the execution of the program at a particular point, so that the state of the program can be examined at that location. Breakpoints enable this to happen. Breakpoints can be set at different locations in a source file, and then the program is allowed to run. When a breakpoint is encountered, the execution of the program is suspended, enabling expressions to be evaluated, variables to be inspected, the stack trace to be studied, and so on.

Page 48: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

48

Figure 2. Breakpoint dialog

Location, refers to the location of the code in the source file. Location can be specified in any of the following formats:

1. File_name:Line_number 2. Function_name 3. File:Function_name

The first one is obvious — The location refers to the line number Line_number in the source file File. The second refers to the first line of the function Function_name. The third is similar to the second, except that this notation is used where there is more than one function with the name Function_name in the program. It is possible to differentiate between them by providing the File, so the notation refers to the function Function_name in the file File.

Two parameters can be associated with each breakpoint:

1. Break condition

Page 49: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

49

2. Pass count

The Break condition is a valid C expression which should evaluate to a Boolean value — that is, the evaluation of the expression should result in either TRUE(1) or FALSE(0). If the final evaluation value is not a Boolean value, then it will be appropriately type casted to a Boolean.

Every time the breakpoint is encountered during the execution, the break condition will be evaluated. The debugger will break the execution only if the evaluation results in a TRUE value, otherwise it will continue the execution as though there had been no breakpoint.

The default value of Break condition is always TRUE. The debugger will break the execution at the breakpoint location.

The Pass count is an integer (unsigned) value which tells the debugger to skip the breakpoint that number of times before it is considered. Pass count has a higher priority than the Break condition. Only when the Pass count reaches zero will the debugger evaluate the Break condition (if any condition is present). If there is no condition, the debugger will break the execution once the Pass count counts down to zero.

The default value of the Pass count is zero. The breakpoint will be considered when it is first encountered.

Adding or Setting Breakpoints

The Breakpoint editing window can be opened by choosing View->Breakpoints or Debug->Breakpoints->Breakpoints …. Click on Add. A dialog will appear.

Figure 3. Breakpoint add dialog

Enter the location at which to set the breakpoint. Optionally, enter the Break condition and the Pass count in the appropriate entry boxes. Click OK to set the breakpoint.

A breakpoint may also be by highlighting the function name in the editor and choosing the menu item Debug->Breakpoints->Set Breakpoint (or by clicking on the Toggle breakpoint at cursor button on the Debug Toolbar).

Page 50: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

50

Editing Breakpoints

Open the Breakpoint editing window by choosing the menu item View->Breakpoints or Debug->Breakpoints->Breakpoints …. Select the breakpoint to edit and click on Edit. A dialog will appear.

Figure 4. Breakpoint edit dialog

Edit the entries as required and click on OK to commit the changes.

Deleting Breakpoints

Open the Breakpoint editing window by choosing the menu item View->Breakpoints or Debug->Breakpoints->Breakpoints …. Select the breakpoint to delete and click on Delete. The breakpoint will be deleted.

To delete all breakpoints, click on Delete All.

Enabling or Disabling Breakpoints

Open the Breakpoint editing window by choosing the menu item View->Breakpoints or Debug->Breakpoints->Breakpoints …. Select the breakpoint to enable or disable and click on Toggle Enable. The breakpoint will be enabled or disabled, depending on the current state.

To enable all or disable all breakpoints, click on Enable All or Disable All.

Note

When the debugger is started, all breakpoints will be set. Any old breakpoints (where the source file is more recent than the breakpoint) will be disabled.

Working with Expressions

Page 51: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

51

FIXME:

Evaluating expressions

When control is returned from a program — possibly at a breakpoint — it is possible to evaluate expressions or inspect the values of variables in the program. Choose the menu item Debug->Inspect/Evaluate …, or click the Inspect button on the Debug Toolbar. A dialog prompting for the expression will appear. Supply a valid C expression, or a variable name, and click on OK.

Figure 5. Inspect/Evaluate dialog

A window will appear showing the result of the evaluation.

Page 52: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

52

Figure 6. Evaluation result

Alternatively, it is possible to highlight the expression in the editor and perform the above steps. This will save typing the expression in the Inspect dialog.

The expression may be any valid C expression and may include function calls from the program, library calls, system calls, etc..

Expression Watch

Inspecting or evaluating an expression provides the result only once. To continuously monitor some variables or expressions, use expression watch.

Add all the expressions and variables to monitor in the watch. These values will be automatically updated and shown in the expression watch window.

Figure 7. Expression Watch window

Adding an expression to watch

Choose the menu item View->Watch Window. Right-click on the expression watch window to open the Operation menu. Choose the menu item Add. A dialog prompting for the expression will appear. Enter the expression and click OK.

Figure 8. Add Expression dialog

Page 53: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

53

If the expression was selected in the editor prior to the addition, it will automatically appear in the dialog.

Removing an expression from watch

Choose the menu item View->Watch Window. Right-click on the expression watch window to open the Operation menu. Choose the menu item Remove to remove the entry.

Clearing the watch

Choose the menu item View->Watch Window. Right-click on the expression watch window to open the Operation menu. Choose the menu item Clear to update or clear.

Local varables

Local variables of the current frame (the current funtion in which the program control is present), displayed and updated in the Locals pane of the message manager. During execution of the program (eg. during single stepping), local variables will be updated. If any varialble value was changed in the last debugging step, its value will be highlight in red. The variables are presented in a tree form for easy view.

Figure 9. Local variables

Varables tips

Variable tips is a quick way to find out the value of a variable. Hover the mouse cursor over the variable name whose value you would like to have and wait for a couple of

Page 54: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

54

seconds. The value of the variable (if availabe with the debugger) will be displayed as a tip.

Figure 10. variable-tip

Stack Trace Stack Window

The Stack trace window shows the contents of the program stack. It lists all of the functions and their arguments in the sequence they were called. There is also a number representing each call. This number is called the Frame. Each call in the trace exists in a different frame. This starts from frame 0 (the last function called) and grows higher as the function nesting become deeper.

Choose the menu item View->Program Stack, to open the stack trace for the program being debugged.

Page 55: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

55

Figure 11. Stack trace window

A small arrow points to the currently selected frame in the stack trace. By default, this will be frame 0, the last function called. All of the evaluation and inspection of expressions or variables will be with reference to this selected frame. The scope of the variables or expressions being evaluated will be limited to the selected frame only. The same applies for expressions in the watch.

Setting the current frame

Double-clicking on any frame in the stack trace will set that frame as the currently selected frame (the arrow will point to the frame, indicating that it has been selected as the current frame). Alternatively, open the Operation menu by right-clicking on the Stack trace window, and choose the menu item Set frame to set the frame.

Information about the current frame

It is possible to obtain information about the currently selected frame by choosing the menu item Debug->Information->Info Current Frame. A window will open describing the current frame.

Figure 12. Current Frame Information

Updating Stack trace

Choose the menu item Update from the Operation menu (right-click on the Stack trace window) to refresh the Stack trace window.

Others

Page 56: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

56

There are a number of other debugger features which are used less frequently, but are nevertheless handy.

Kernel Signals

Kernel signals are a way of signaling between processes in Linux. The list of signals available for a program can be displayed by choosing the menu item View->Kernel Signals. A window will open which lists all of the signals available in the system along with a brief description of each signal.

Figure 13. Kernel Signals window

There are three columns which specify what to do when the signal is received:

1. Stop — this tells the debugger whether to stop the program execution (and return control) when the program receives this signal.

2. Print — this tells the debugger whether to display the received signal. 3. Pass — this tells the debugger whether to pass the signal to the program.

Changing behaviour on signals

To change the way debugger behaves when a particular signal is received, select the signal in the list. Right-click to open the Operation menu. Choose Modify Signal. This will open a dialog. Set the three behaviours and click OK to commit the change.

Page 57: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

57

Figure 14. Modify Kernel Signal dialog

Sending the signal to the program

To explicitly sent the signal to the program being debugged, select the signal in the given list. Right-click to open the Operation menu. Choose the menu item Send to process. A confirmation dialog will appear. Click OK to confirm and send the signal to the program.

Updating the signal list

Choose the menu item Update from the Operation menu (right-click in the Kernal Signals window to open) to refresh the Kernel Signals window.

CPU registers

It is possible to examine the contents of the internal registers of the CPU (microprocessor). Choose the menu item View->Registers. A window listing all of the available registers in the microprocessor and their corrosponding contents will appear.

Page 58: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

58

Figure 15. CPU Registers window

Dynamically loaded Libraries

To obtain a list of the dynamic libraries used by the program, choose the menu item View->Shared Libraries. This will bring open a window which will list all the shared libraries the program has loaded and their locations in the memory. It also shows whether the symbol table is loaded or not (Yes/No).

Page 59: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

59

Figure 16. Shared Libraries window

Interrupting the program

While the program is running and has control, no debugging tasks can be performed. To obtain control while the program is running, choose the menu item Debug->Interrupt Program. This will interrupt the program and return control to the debugger.

For interruption to work properly, set the debugger behaviour for the interrupt signal (SIGINT) to the value [ Stop:Yes, Print:Yes, Pass:No ]. This is the default value.

Preferences Preferences are ways to customize anjuta to suit your tastes. Activate Settings->Preferences to bring up the preferences dialog. If you want to reset the preferences to their default values, it can be done from Settings-> Set Default Preferences. Some are explained below.

General 1. Project Directory is the path where you plan to put all your projects. Application

wizard creates new projects in this directory only. The default project directory is ~/Projects and generally, this is just fine for most people. Also, when Open project is activated, this is the base directory where the file selectior will start.

2. History Size defines the maximum history length of recent projects, recent files and other combobox pop down list (eg. the search combo). Maximum possible values that could be given in these history sizes is 20. That value should be more

Page 60: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

60

than enough for most situations. Choose the right value for your own convenience.

3. Automatically load last project, if checked, will make anjuta (upon starting) to load the last project it was working on before it quit. However, this thing will not happen if anjuta is started with files and/or project given in command line. Anjuta will load these command line files/projects, even if this option is set.

4. Build Symbol Browser Automatically, if checked, will make symbol browser to automatically update it's database whenever necessary (for example, after some modifications in a file). This makes sure that the database is kept synchronized with the current state of the source, but at the cost of some additional CPU time.

5. Build File Browser Automatically, if checked, will make the file browser to automatically update it's database whenever necessary (for example, file saves). This option and the previous option could be disabled to improve the performace a bit at the expense of some mis-synchronization. In any case, you should be able to update these database from Project->Update tags image. Project->Rebuild tags image will build the whole database from scratch (as opposed to just updating it) and therefore takes longer time to complete (but you get most up to date database).

6. Update tags image automatically, if checked, will update the tags image automatically. Disable it if you want some improved performace.

7. Beep on job complete and Dialog on job complete, if checked, will beep and/or show a dialog when a job is completed (eg. compiling, building).

8. Show tooltips, if checked, will show tooltips on toolbar buttons (obviously). Keep it checked until you find it annoying.

9. Use glade components (experimental) should not be checked normally. It's an experimental feature and is not ready yet.

10. User Info: Provide your correct Name and Email address here. They are not used to do software registration (pun), rather they are used to create ChangeLog entries and other insert text bits.

Build 1. Keep going when some targets cannot be build, if checked, will invoke the make

with the -k or --keep-going option. This makes make to continue the make process even if there are errors found in some rules. Without this option, make terminates when it encounters the fist error. Read the make info page for more details.

2. Silent do not echo commands, if checked, will not show the make commands before they are executed.

3. Produce debugging output, if checked, produces lots of outputs during the build. Better keep it unchecked.

4. Warn when an undefined variable is referenced. does exactly what it says during the build process. Useful if you want to keep your Makefiles clean and tidy.

5. Autosave before Build will save the files before they are build, if checked. This makes sure the build gets the lasted file contents.

6. Max number of jobs gives the maximum number of jobs make can spawn during the build process. Usually, make likes to spawn as many processes as possible which are independent of each other. This virtually speeds up the process, can

Page 61: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

61

can clog the CPU if run on slow computers. Give a reasonable maximum number of jobs it should handle which will be comfortable with your computer. By default, it's set to 0 (zero) which means infinite number of jobs can be spawned.

User-defined Tools

Introduction Often, you'll find the inbuilt functionality provided by Anjuta to be insufficient. In these cases, you might be tempted to either add the feature yourself to the Anjuta codebase or submit a feature request to implement the feature. However, both approaches are likely to be slow and problematic, especially if your tool is a specialized one. In these circumstances, it is advisable to use the Anjuta tools framework instead.

Anjuta provides a powerful framework for defining user-defined tools for extending it's functionality. Tools have access to almost all features of the IDE through the use of variables. You can add tools under any menu item, specify input, output and error redirection within the GUI framework and supply command line parameters to the tool.

User-defined Tools

Introduction Often, you'll find the inbuilt functionality provided by Anjuta to be insufficient. In these cases, you might be tempted to either add the feature yourself to the Anjuta codebase or submit a feature request to implement the feature. However, both approaches are likely to be slow and problematic, especially if your tool is a specialized one. In these circumstances, it is advisable to use the Anjuta tools framework instead.

Anjuta provides a powerful framework for defining user-defined tools for extending it's functionality. Tools have access to almost all features of the IDE through the use of variables. You can add tools under any menu item, specify input, output and error redirection within the GUI framework and supply command line parameters to the tool.

Tools Examples Simply put, a tool is any external command that you want to use from within the GUI framework of Anjuta. As a simply example, say, you want to use Doxygen to build your project documentation. But you don't want to resort to the command line every time you want to fire the command 'doxygen' to update your project documentation. Further, you want single-click access to the files and lines specified in the warning and error messages of Doxygen, just as you do with the C compiler.

Page 62: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

62

Figure 1. Defining Doxygen as an user-defined tool

The above figure shows how you can use the tool editor to specify Doxygen as a project level tool. Here is another example which shows how you can use the excellent A2PS tool as an alternative to Anjuta's inbuilt printing support.

Page 63: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

63

Figure 2. Using A2PS for Printing

The above screenshot also shows the use of variables. You can use numerous variables to define command-line parameters as well as standard input to the tool. A complete list of variables is available for your reference with the tool editor. To see this list, press the 'Help' button while in the tool editor.

The tool editor shown in the above screenshots can be accessed from the 'Settings' menu of the IDE. When invoked, it shows a list of currently defined user tools. Initially, the tool list will be empty, but this will change as you add new tools using the tool editor. The tool editor supports adding, removing and editing tools.

Page 64: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

64

Figure 3. The tool editor

Authors The Anjuta project was founded by Naba Kumar. Naba is from India (Manipur) and got his B.Tech degree in electronic and communication engineering from North Eastern Regional Institute of Science and Technology (NERIST), India.

Anjuta was written by Naba Kumar, St鰨ane D魵rget, Luca Bellonda, Hector Rivera Falu, Andy Piper, Max Blagai, Johannes Schmid, Rick Patel, Denis Boehme, Fatih Demir, Archit Baweja, Martyn Bone, Venugopal Gummuluru, Gregory Schmitt, Yannick Koehler, Giovanni Corriga, Dan Elphick, Biswapesh Chattopadhyay, Jason Williams, Dick Knol, Benke L�l��Timothee Besset, Roel Vanhout, Roy Wood, Tina Hirsch, Jeroen van der Vegt, Ishan Chattopadhyaya, Todd Goyen, Nick Dowell, Pierre Sarrazin, Kelly Bergougnoux, Dave Huseby, S颡stien C? Jean-Noel Guiheneuf and Stephen Knight.

Thanks go to the translators: Javier Conde Rueda, St鰨ane D魵rget, Takeshi Aihana, M.Ali Vardar, Michele Campeotto, Christian Rose, Yuriy Syrota, Valek Filippov, Marc Botermans, Joe Man, Conner Mo, Jens Georg, Kjartan Maraas, Dinesh Nadarajah, Christian Meyer, Simos Xenitellis, Duarte Loreto, Marcelo Elias Del Valle, Gitte Wange, G? Weinholt, Keld Simonsen, Martin Lacko, and the GNOME Polish and Azerbaijani Turkic translation teams.

For more information on Anjuta, please visit the project website at http://anjuta.org. Bug reports should be made using the Bug Tracker at the project development site http://www.sourceforge.net/projects/anjuta

Page 65: Anjuta IDE Manualalfa.facyt.uc.edu.ve/computacion/pensum/cs0118/clases/Lab... · 2009. 4. 1. · Anjuta IDE Manual 9 when you exit Anjuta.Session management is still under development,

Anjuta IDE Manual

65

This manual was written by Naba Kumar and Andy Piper. Please send all comments and suggestions regarding this manual to Anjuta Devel list <[email protected]>. Comments may also be submitted via the project trackers at SourceForge.

License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License is included as an appendix to the GNOME Users Guide. You may also obtain a copy of the GNU General Public License from the Free Software Foundation by visiting their Web site or by writing to

Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307 USA


Recommended