Compiling Simple Ada Programs

Naming

Make sure that the file has the same base-name as the "main" program and has .adb as its extension. For example, if decode is the name of your main program, decode.adb should be the name of your file.

Compiling

To compile, login onto burnsville and run the command

where FILENAME.adb is the name of the file in which your program is stored.

Running

If the compile is successful, your executable program will be stored in the file FILENAME. To run it, simply type:

In Case of Trouble

To compile using gnatmake, you must have /usr/local/bin in your PATH. To run your program, you must have the current directory "." in your PATH.

If you have to compile a program writen using packages (which you shouldn't have to do for this assignment), it is best to use a Makefile. As an example, look at ~brock/classes/431/Aprogs/Makefile.

Error Messages

Sometimes you will write code that contains syntatic or semantic errors that will be uncovered by the Ada compiler. In that case, you will get a message similar to the following for each error:


These messages contain four fields:
  1. The name of the file with the error
  2. The line number of the error
  3. A charcter position within that line
  4. A description of the error

In this case, the offending line (line 40 of myprog.adb) is:

The problem here is that the single quotes around the E were omitted and the compiler interpretted E as an undefinded variable.