Creating a new project for Ada development is easy with the GNATbench wizards. There are multiple wizards defined for this purpose. One wizard creates a new project supporting "debug" and "release" build scenarios. Another wizard creates a "basic" project that has no build scenarios and always applies switches typical for debugging and testing. Both wizards create projects that have a separate folder for intermediate files produced by the builder (e.g., object files and "ali" files) so that the root folder is not cluttered. Another wizard creates a project with most settings defined by the user.
There are many ways to select and invoke the GNATbench new-project wizards. See Wizards for illustrations of all the different methods.
Perhaps the easiest way to invoke one of these wizards is to click on the down-arrow next to the new-project icon on the toolbar, as shown below:
However you invoke the wizards, the first page of the new-project wizard will appear. The first page of the dialog will have a distinct title and description, depending on the kind of project being created, but the required input is the same for each. Subsequent pages will vary, depending again on the kind of project being created and the amount of configuration left to the user.
Note that all of the dialog box options and entries on a given page may not be visible if you resize the dialog box of the previous page. If so, simply enlarge the box.
In the first page you always specify the name of the new project and choose where the new project will reside. Typically this location will be the workspace so you can take the default, but otherwise you can specify an external location on the file system. (The page below is for the basic project creation wizard.)
Pressing Next will take you to the page shown below, where you specify information about the Ada main subprogram and make source code generation choices.
First comes the text entry box where you specify the unit name of the Ada main subprogram, if there is to be one. Note that this is the name of the subprogram, not the name of the file, so an extension is neither expected nor allowed. The field is not required because a main subprogram is not required for an Ada project. For example, if you are creating a library project a main unit is not expected.
The first option offered on the page is whether you want the wizard to generate a file containing the main subprogram on your behalf. If you do, the wizard will generate it with the unit name you specify. If no unit name is specified the option is disabled.
The next option, enabled if the first option is chosen, specifies whether this generated main subprogram implements the "hello world" application. This capability is purely for your convenience so that you can immediately have an "interesting" program to build and debug immediately after creating a new project. If chosen, the subprogram will look like the following (assuming the unit name is "mymain"):
If you do not enable the "hello world" option, the generated main subprogram will have a null statement body but will still be buildable.
The next page provides language and tool configuration specifications:
The first of these configuration choices is whether you want to compile using Ada 2005. The compiler will use Ada 95 if the option is not checked.
Next you select or specify the name of the Ada builder to use. You can select the name from the list of builders defined by GNATbench, or enter the name manually. This selection is shown in the following figure:
If you choose the builder from the list you can then press Finish. Likewise, if you manually enter one of the names from the list you can also press Finish.
However, instead of using one of these builders you can specify the name of a builder not previously defined by GNATbench. This "foreign" compiler may be a GNAT compiler that GNATbench happens not to have included in the list, or it could be a completely unknown Ada compiler. In either case you are required to enter the actual commands that GNATbench will use for the various builder commands when using this "foreign" compiler. The corresponding text entry boxes become enabled, as shown in the following figure:
Specifically, you will have to enter the command to do a full project build, the command to clean a project, the command to execute when the project option "Automatically Build" is enabled, and the command to analyze the sources for syntax and semantic errors (but not generate code).
Once all the required entries are made you can then press Finish and the new project will be created for you.
Other wizard pages will be presented by other wizards. For example, the general new Ada project wizard will also allow the user to specify folder names for the object files and executable image, as shown below: