As a Computer Engineering student, this year I had to program at Ada. And my surprise has been, especially because Ada is still a fairly well-known language, that there is very little documentation about this language.
Many of my colleagues who use GNU / Linux have ended up using a Windows virtual machine to "keep things simple", but actually compiling Ada on GNU / Linux too easy. Therefore, in this article we want to show you how to do it step by step. The purpose of this article is to teach you how to compile Ada in our Ubuntu, something that from the information that we will find on the internet, seems a complicated task.
Ada is a programming language quite old, so your documentation has become somewhat outdated. You can see for yourself that if you Google how to compile Ada in GNU / Linux, very little information comes out. Even so, as we already mentioned, compiling Ada is as easy as installing the GNAT compiler, which is part of the GNU Compiler Collection.
For this, it is enough that we execute the following in the Terminal:
sudo apt-get install gnat-4.4
And that's it, we can compile Ada in our Ubuntu. That easy.
Now, if we want to have GNAT-GPS, the GNAT Development Environment, we have to install it by executing the following:
sudo apt-get install gnat-gps
Once installed, we will already have an IDE like the one in the image that heads this article.
As you see, they exist two way to compile Ada on Ubuntu, from the IDE itself, through the "Build All" button, or using another text editor (such as Vim) and compile it from the terminal.
Personally I like to do it the second way, since with a single command you can already compile an entire project. And it is that, to put it in some way, with Gnat just compile the main program, and it is already in charge of searching for all the packages that we are using in our project.
For example, if we have a program called main.adb that uses other packages (other .ads and .adb), just make use of Gnatmake, as follows:
gnatmake main.adb
And then run the output file with:
./main
As you can see, compiling Ada in Ubuntu is very simple. The truth is that as I mentioned earlier, there is quite little information on the internet, so at first it may seem that compiling Ada in GNU / Linux is a cumbersome or difficult job, but nothing is further from the truth, we have seen how with a simple command We can compile a whole project, and if we are more than IDE, then we also have one at our disposal.
We hope that the article has been helpful to you
I thought Ada was already in disuse!
Well, although it is not 100% obsolete, the truth is that in general it is being used less and less. Even so, it is a language that is often used a lot in universities, especially because of how well it represents object-oriented programming and the independence between the declaration and the code implementation.
Hello:
As of today, April 2021, I get this error:
E: The "gnat-4.4" package does not have a candidate for installation
Greetings.