ADA for Computer Control Students - University of Almería - B. in Electronic Engineering and Industrial Automation - 2025/2026
Repository with the necessary packages and instructions for programming ADA in VisualStudioCode (VSC) on Windows (10 and 11) and Linux (Not available for MAC).
Note: Process tested with Windows 11 on 13th March 2026.
Author: Fernando Cañadas Aránega, PhD student in Agriculture Robotics at the University of Almeria, Spain.
Gmail: fernando.ca@ual.es
Website: https://linktr.ee/FerCanAra
LICENCE: Intellectual property patent no. 2601204317192 held by Safe Creative
We will use Visual Studio Code as our editor, Alire as our IDE, and AdaCore as our compiler.
1.1. Programming with Visual Studio Code and GNAT
If your operating system is Windows 10 or 11, download the compiler gnatstudio-26.0w-20250417-x86_64-windows64-bin.exe from AdaCore and the visualizer GNATSTUDIO using your Gmail address @inlumine.es. Also, download Visual Studio Code and Alire. If you are using Linux 18.04 or later, download the file gnatstudio-26.0w-20250417-x86_64-linux-bin.tar.gz from AdaCore. To configure the environment, proceed to step 2.
1.2. Programming using GNAT Studio only
For Windows 10 or 11 users only: go to this Drive folder using your Gmail address @inlumine.es and download the file ‘GNAT_CpC.zip’. This interface is already fully configured; you simply need to follow these steps:
- Unzip 'GNAT_CpC.zip' IN
C:. - Navigate to
C:\GNAT\2021\bin\and locategnatstudio.exe. Run it (tip: create a shortcut to this file and place it on your desktop). - In the application window, click
Create New Project. - Select
Simple Ada Project. - Choose a save location and enter a name.
- Click
Apply.
You can skip straight to point 6.
2.1. For windows
Double-click on the launcher of "AdaCore", "VSC" and "Alire", and install the programs in the default path. For "GNATSTUDIO", Unzip 'GNAT_CpC.zip' IN C:. Navigate to C:\GNAT\2021\bin\ and locate gnatstudio.exe. Run it (tip: create a shortcut to this file and place it on your desktop).
2.2. For Linux
Go to the download location of the gnatstudio-26.0w-20250417-x86_64-linux-bin.tar.gz, unzip the file, go into the directory and open a terminal. Run this command:
chmod -x doinstall
Subsequently, run the image with the following commands:
./doinstall
Locate the folder where you installed GNAT Studio and Alire. Generally, this will be something like C:\GNATSTUDIO\bin and C:\Program Files\Alire\bin (Note: These paths must appear exactly as shown. If you copy them directly from this repository, they are often copied incorrectly to the clipboard). Follow the steps below to add environment variables:
- Press Win + S and type
Variables de entorno. - Click on
Editar las variables de entorno del sistema. - Click on
Variables de entorno...in the bottom right-hand corner. - In the
Variables de usuario para <user>section, find the variable namedPathand select Edit. - Click New.
- Add the full path to the GNAT Studio bin directory
C:\GNATSTUDIO\binin system variables and save it. - Then, press
Variables para el entorno, find the variable namedPathand select Edit. - Click New.
- Add the full path to the GNAT Studio bin directory
C:\GNATSTUDIO\binand AlireC:\Program Files\Alire\binin user variables. Save it
First, create a folder on your desktop called Ada_project. Press the Windows key, type Alire and, in the pop-up window, go through the following codes (By default, it is in C:\Users<your_user>). Now, navigate to that folder using ina Alire terminal with the following command: cd .\Desktop\Ada_project\ (If you are logged into OneDrive, the command to navigate to the folder is cd .\OneDrive\Desktop\Ada_project\). Once you are in that directory, create a project by following these steps:
- Create a project.
alr init --bin project_name
Please wait a few seconds for msys2 to install automatically.
- In the next action, press 2 and press Enter.
Select the kind of crate you want to create:
1. LIBRARY
2. BINARY
- For licences, press 4 and press Enter.
Select a software license for the crate?
1. MIT OR Apache-2.0 WITH LLVM-exception
2. MIT
3. Apache-2.0 WITH LLVM-exception
4. Apache-2.0
5. BSD-3-Clause
6. LGPL-3.0-or-later
7. GPL-3.0-or-later WITH GCC-exception-3.1
8. GPL-3.0-or-later
9. Other...
Press Enter with the following options, until you get Success: project_name initialized successfully.
- Compile the project
Enter the folder created with
cd project_nameand run:
alr build
You must return Success: Build finished successfully in x seconds.
Note: If you encounter an error, scroll down to the bottom of the page to find the solution.
Now, press the Windows key and type VisualStudio. In the pop-up program, follow the instructions below:
- Go to Extensions, search for
Ada & Sparkand install it. Restart VSC by closing it and reopening it. - Go to File and open folder. Navigate to this folder
C:\Users\<your_user>\Ada_project. - Wait a few seconds, then select the file you want to run from the search bar (Visual Studio will suggest the correct one).
- Open the src folder, and you will find a file called
project_name.adb. Open it by clicking on it and paste the following code:
with Ada.Text_IO; use Ada.Text_IO;
procedure project_name is
begin
Put_Line("I am going to approve CpC :) ");
end project_name;
Note: If you encounter an error, scroll down to the bottom of the page to find the solution.
- Execute the project. This can be done in two ways: a) You can press the ‘Play’ button and watch the terminal that appears: b) Run the following command in the Alire terminal:
alr run
In the terminal, the following should appear I am going to approve CpC.
Note: If you encounter an error, scroll down to the bottom of the page to find the solution.
If you want to change the run file, go to project_name.gpr and, on line 8, change the following line to the name of the new project:
for Main use (‘project_name.adb’);
by:
for Main use (‘new_name.adb’);
Close and reopen VisualStudio to load the new address. Run play again. Every time you want to change the main, you should do it this way.
To run this project, you have two options:
-
Start a new project, as explained in section 4, and copy the files inside the src folder of this one to the new project (Recommended). Change the
.gprand restart VSC. -
Clone this repository and change the correct addresses in the configuration files. Restart the PC
-
For users who only use GnatStudio: Click on the pencil icon just above your main folder, go to
main, click on-to delete the existing entry, and add the new one by clicking on+(note: there should only be one entry under “Main Files”)
Warnings
(style) space required [-gnatyt]:: They indicate that a space is missing in the code. For example,:Steering_Angle:=Steering_Angle+1.0;: should be written:Steering_Angle := Steering_Angle + 1.0;:.(style) this line is too long [-gnatyM]: Indicate that a line exceeds the character limit (default 80). To solve this, split the line into several lines.variable "Hum" is not referenced [-gnatwu]: It is defined, but not used.Valor_Otro_Indice" is not modified, could be declared constant: You define it, use it, but do not change its value. Suggest making it fixed to make it more secure.trailing spaces not permitted [-gnatyb]: There are extra spaces at the end of a line. It is suggested that they be removed to make the program faster. For example::X := 10;␣␣␣ -- ← estos espacios al final no se ven, pero están..useless assignment to "Lectura", value overwritten at line 230 [-gnatwm]: The same variable is simply defined twice.no entities of "Ada.Numerics.Elementary_Functions" are referenced [-gnatwu]follow byuse clause for package "Elementary_Functions" has no effect [-gnatwu]: A library is declared but not used.
Error
ERROR: No index.toml found in index: the libraries have not been installed correctly (Probability, Git). In this case, install git for Windows, run the command the follow command:
alr index --reset-community
alr toolchain --select gnat_native
alr toolchain --select grpbuild
Note:: You should have gnat_native version 15.2.0 and gprbuild version 22.0.1. Once these commands return no errors, run
alr buildon the project.
project_name.exe does not exist: The project was compiled on another computer. Create a project using Alire as described in point 4, then go to the src directory and copy the .adb files there. Navigate to that location in Alire and runalr build.Errors related to .gpr: The environment variables are not set up correctly. Go back to step 3 and check that the variables are correct.

