SD.
SD.

Reputation: 1500

"Unbounded" is not visible in Ada

I am just a beginner in Ada,

my code looks like this,

with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;

procedure final is
Input : Unbounded.String;

begin
null;

end final;

When i compile this code with gnatmake, compiler gives error "Unbounded" is not visible", what does this mean?

Upvotes: 0

Views: 897

Answers (1)

Keith Thompson
Keith Thompson

Reputation: 263227

The use clause for Ada.Strings.Unbounded makes declarations inside that package directly visible. It does not make the package name itself (Unbounded) directly visible, so any reference to the name Unbounded that's not preceded by a . is going to be incorrect.

Furthermore, the type is called Unbounded_String, not String.

Change this:

Input : Unbounded.String;

to this:

Input : Unbounded_String;

(And please indent your code.)

Upvotes: 4

Related Questions