DIR Return Create A Forum - Home
---------------------------------------------------------
Ada Programming Forum
HTML https://adaprogrammingforum.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Ada 83 - 2012 and Beyond
*****************************************************
#Post#: 10--------------------------------------------------
BUG I cannot figure out
DIR By: compuGUY
Date: October 22, 2021, 4:57 am
---------------------------------------------------------
sup
got tis error in my code:
--- Code ---
with Ada.Text_IO;
use Ada.Text_IO;
package sup;
procedure main is
begin
Put("Hi");
end main;
--- End Code ---
Error shown is: package 'sup' is not declared in this scope'
Can some fix plz?
#Post#: 16--------------------------------------------------
Re: BUG I cannot figure out
DIR By: Ada Lovelace
Date: October 22, 2021, 5:23 am
---------------------------------------------------------
Hi CompGuy and welcome.
I take it this is a single source file as part of a project? A
package is a defined body of statements (for instance, the
random number library for Ada is defined within a package),
which needs to be declared.
For example, you could have a separate file which creates a
package such as:
file mypackage.ads
--- Code ---
package MyPackage is
-- statements here
end MyPackage;
--- End Code ---
file mypackage.adb
--- Code ---
with MyPackage;
use MyPackage;
-- implementation of procedures and functions associated with
MyPackage
--- End Code ---
file main.adb
--- Code ---
with MyPackage;
use MyPackage;
procedure main is
begin
MyPackage.Hello; -- example of something declared within
MyPackage.ads
end main;
--- End Code ---
All three files are then compiled and linked together to create
an executable. If you need further explaining, ask and I am sure
another member or myself can aid you further.
Wishes Ada x
*****************************************************
Page 1 of 1