RU beehive logo ITEC dept promo banner
ITEC 320
2018fall
nokie
ibarland

how to run Ada
from rucs and your U: drive

Run from rucs and your U: drive

  1. Mount your U: drive (Instructions on D2L discussion-board, and other places.)
  2. Create folder(s) for this semester (e.g. itec320 » lect)
  3. Create the file a file hello.adb in that directory.
    You can use an editor (such as Notepad++) on your local computer; just be sure to save the file in that folder on your U: drive.
  4. Connect to rucs via putty/ssh (Instructions on D2L discussion-board, and other places.)
  5. On rucs, change your current-directory via “cd”: enter cd itec320/lect/, and then ls to make sure you see hello.adb.
  6. gnatmake hello.adb
  7. hello
  8. Celebrate.
See also: Some alternate notes, if you get stuck: getting started with Ada and using an IDE.

Write & Run from rucs's command-line

As above, except rather than edit the file on your own machine and save to the U: drive, go to rucs (via putty/ssh) and run vi hello2.adb or nano hello2.adb to create the file.

If you want to create a new folder from the command-line, use the UNIX command mkdire.g. cd itec320 followed by mkdir hw00 and then cd hw00 (and perhaps ls to verify you're in an empty directory).

Run from your computer's command-line

First, you ust download & install gnat, as per here.

On Windows, Start »bash will start a bash shell, if you have installed bash (and you are highly encouraged to do so; google-instructions abound for “install bash on Windows 10”).

If you are on a Windows machine where you can't install bash, then Start »cmd will start a Windows command shell. This gives you a terminal similar to a restricted unix/bash shell; you still use cd to change directories, but have to use (e.g.) dir instead of unix's ls to list files. You can google basics of using Windows’ CMD shell.

On Mac, run Terminal (in /Applications/Utilities) (and make sure you set your PATH as indicated in the install-instructions). You can run gnatmake -v to check that the version installed correctly and your PATH is set correctly.

Run from your computer's IDE

As above, but rather than Notepad++ you can use (say) gps (part of the gnat install), or AdaGide.

AdaGide projects: To use GPS, you need a "project"; there is a "project wizard" that works great if you don't goof it up, but a slight mistake can be difficult to recover from. So instead, before starting AdaGide for a new project, you can initially create the very-simple project-file (using any editor you like), named (say) hello.gpr with the contents:
project hello is
  for main use("hello.adb");
end hello;
    
Then, double-click on this file, and AdaGide should launch with the project already established. (Of course, you'll probably want to make that project-file inside a folder like itec320/lect.)

If your IDE is running on your computer (say, a Windows machine), it might create an executable hello.exe on your U: drive, but that executable will only run on the OS you compiled it on!. So your IDE might create hello.exe but that's separate from creating an executable hello via running gnatmake on rucs, which is in turn different than running gnatmake on Windows.


Sample program

Here is a hello-world you can paste in, for practice above:

   with Ada.Text_IO; use Ada.Text_IO;

   procedure hello is
   begin
      new_line;
      put_line("Hi!");
      new_line(2);
      put("Welcome to");
      put_line(" ITEC 320!");
   end hello; 
    


logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated 2018.Aug.31 (Fri)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.