"Give us the tools, and we will finish the job."

 
 

Winston Churchill

 

Main CodeBench Icon This is a guide to creating your first project and shows you how to work with it. So without any further ado, on with the show...

 

The standard installation includes a sample project that we can use to demonstrate how easy it is to set up a new project, and navigate the files that are part of it.

Even though this example project is complete, it has no associated project file, so we shall create one now. Go to the directory that you installed CodeBench to and double-click the icon to start the program.

 

You will see a toolbar window at the lower left position.

CodeBench Toolbar

 

The default preferences enable Help Hints for various interface components. They can be accessed by hovering the mouse pointer over the gadget of interest for a short while. Click in the toolbar window to activate it, and try out the hints for yourself. You will find the button to create a project is the fourth one in from the left.

 

Project Type Selection Window

Clicking the button will open the project selection window and allow you to specify what type of project you want to create. For this demonstration project, you need to select "AmigaOS4SDK" by double clicking the name in the list. If you are using a free licence version of the program, this stage is skipped, and the project type is automatically set for you depending on which version you are using.

You will notice that we have two distinct types of plugin here. This is due to having some extra visual ones installed. More information on these is available from their respective help pages.

Selecting "Project" plugins will create a new project as described below, whereas the "Visual" plugins will start the graphical builder that this plugin supplies.

 

We shall be using the AmigaOS4SDK type of project for this tutorial, but the Hollywood4 project type is equally applicable. You may need to consult the Project Information pages for that project type if in any doubt, but the two processes are very similar.

The AmigaOS4SDK Project Information window will now open, and this allows you to set up various parameters of the project. The first section requires you to set the name of the project, so enter "Demo" in the name gadget. Next, is the directory where the project shall be based on disk. This path is used as a default location to load project files from, so set that now by clicking the small "getfile" button on the right of the string gadget.

The file requester will prompt you for the directory, so select the "Demo" drawer and confirm the requester. We will not require a specific directory for header files, so leave that blank. The system has given you a default debugger name and path which suits the hierarchy of the AmigaOS4 SDK, but you can change it if you decide to use a different debugger.

Project Information Window

 

The next 3 sections deal with the actual creation of the finished article for the project, the first specifies how the Build script is handled. In the context of the AmigaOS4 SDK, the build script is a " makefile", and you can elect whether you want to create a fresh one when required. If you are starting a project from scratch, this is a good idea due to the dynamic nature of the build process. More information on these dynamics can be found in the Build section. The builder program, in this case "Make", has also been given a default for you that suits the SDK.

The next page concentrates on the Compiler parameters, but if you disabled the creation of the build script, these choices will not be available to you, as they will be taken from the buildscript directly.

The Targets section allows you to specify how the project is finally created, plus also the name of the resulting program. Create a new target called "MyFirstProject" as shown. When you add files to the project, those files will be added as "Objects" to the target you defined automatically.

The Environment section allows you, amongst other things, to change the way that the user defined labels are generated and displayed, but for now they can stay as they are.

The Help section deals with the dictionary and can be ignored for now.

Select Project OK Button to commit these changes.

Adding files

Project Window You are now presented with the Project window, but as we have not included any files yet, the file sections are empty. Adding files to the project can be done in two ways. The first, and easiest way, is to add all the needed files in one go. If you have an existing program that has all the source required for the project, like in our example, you can use this first method. Select the "Add File..." menu item and a file requester will appear. This file requester will allow you to select all the files in a directory. So to create our project, choose all the files in the requester by drag selecting them. After confirming the requester, the project window will contain the files you selected. Note that they have been categorized into their respective sections ready for you. If, when creating a new project, the files are scattered in different directories, you can add them by using the following second method. Highlight a category heading in the list (source files for example), then click the Project Add File Button button. Now the file requester will match any files that can be included in that section. For our demonstration, highlighting the Source files category will add all files that have a .c or .cpp extension to them. This way of adding files is useful for batches of files of the same type.

Top Tip
You can also select directories as well as files.

Selecting a directory will add the files in it to the project. If a directory is selected in reply to adding a specific type of file (a header or source file for example) then all files matching that type of file will be added.

If a directory is selected when adding any type of file, the files will be sorted and added into their respective sections within the project list.

Also note that the file requester uses paths that are relative to the project directory that you set in the Project Information window. This is important, and although supported, the use of absolute paths should be avoided unless absolutely necessary for the following reasons:

  • it means that if you move your project somewhere else on the disk, the project parameters are of no use and will need to be changed. CodeBench can automatically reconfigure the project for you if it detects it has been moved on disk, or the project directory has been renamed. Paths relative to the project directory will assist this process, meaning that the files can easily be located again when the project is loaded after moving.

  • excessively long file paths may clutter up the build script making it harder to read later on.

  • Absolute paths to assigns will always work, however, so that paths like "include:file.h" will always be found. (Some users like to create assigns to various directories in order to make it easier to locate files from requesters etc.)

 

Quick-Link Window Now we have the files loaded, we may need to edit the source code for the project. In the Source files category you will see the "Demo.c" item. Double click it, and the editor window will open with the source code displayed ready for you to edit. While not a huge source file, it does illustrate the use of the Quick-Link window which will open by default. This window gives you an easy way to jump to various parts of the source file instantly. Our demonstration file includes one function (main) and one user label. Clicking on either will place the cursor at that position in the file. Label names can be anything you require, but ideally should be meaningful at a glance, and for ease, try to keep them short.

Build Window Now that we have given the project at least one source file, you will notice that the Build button Compile Button has become enabled in the main toolbar. Lets compile the program, which as you can see is not much more than a glorified "Hello World" example, by clicking the Build button.
Using the information you entered previously (or the default values), the process of building the project will commence, and this will open the Build window to show you the status of the progress. After the project has been built, the Demo directory will now contain a build script called "Makefile" which is the default for this project type, and also contain the executable freshly created.

Any errors encountered during the building of the project will be shown in the Build window, and also highlighted in the editor. Please see the Build Window section for information of how these errors are dealt with.

back to the top

 

 

Saving and Snapshot

All that remains now is to save the project to disk, so that you can reload it with ease rather than having to create the project each time. The Save Project Button button saves the project with the name and path you specified in the Project Information window. It also gives this project a default icon which has been correctly initialized. In order to reload this project, you can simply double-click the project files icon, and CodeBench will start and load the project automatically, or you can drop the project icon onto the main Toolbar which will load the project for you. When the project is saved, certain information is saved alongside it, namely the cursor and line positions of all the open files. This allows the project to be reloaded in the same state as it was when it was saved, retaining bookmarks, labels and current cursor positions. The last project that you worked on will also be added to a list of recent projects. This list can be accessed from the "Recent" menu item, which is only available before loading a project. Default Project Icon

 

back to the top

 

Valid XHTML 1.0 Transitional This is a W3C checked and compliant webpage.