Install ADA on Ubuntu 14.04

By Rémi GATTAZ RICM3 Polytech

Install ADA

Installing ADA is quite simple. You only need to open a terminal and type the following :

$ sudo apt-get install gnat

And that's pretty much all you need to do. It is probably the easiest developping environment to setup ever.

Test Ada

Maybe you'll want to make sure the ADA compiler is working correctly though. So let's make a "hello World" programm.

First, create a file called 'hello.abd' and place the following in it :

with Ada.Text_IO; use Ada.Text_IO;  
procedure Hello is  
    Put_Line ("Hello world!");
end Hello;  

Now, compile this program using the command gnatmake. You should obtain the following output (The version of gcc may vary) and 3 files should be created.

$ gnatmake hello.adb
gcc-4.6 -c hello.adb  
gnatbind -x hello.ali  
gnatlink hello.ali  
$ ls
hello  hello.adb  hello.ali  hello.o  

Finally, just execute the program.

$ ./hello
Hello world!  

Did it work ? Great, now let's go to the next step, installing Ocaml and the Tuareg mode.

Comments powered by Disqus