Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Path issues with Ada and GNATStudio

Tags:

ada

I have the following code:

with Util.Serialise;
package body blah is

      Reader : Util.Serialize.IO.JSON.Parser;
      Mapper : Util.Serialize.Mappers.Processing;
end blah;

So the line where Reader is defined is fine with the compiler, however on the following I get the error Mappers not declared in Serialize.

Both packages are part of the Ada-Util installation, and in fact are in the same directory.

Is this a path issue? Have I used things wrongly? What's going on here?

like image 600
David Boshton Avatar asked Jan 24 '23 12:01

David Boshton


2 Answers

You need to with Util.Serialize.Mappers; as well, if it's a child package. You should also need a with Util.Serialize.IO.JSON;, don't know why you didn't get an error there

like image 183
egilhh Avatar answered Feb 01 '23 19:02

egilhh


Probably Reader is considered as correct, because it is hidden by Mapper error.

Generally, in Ada you have to give the full package name if you want to have a package visible. Thus, your first two lines should be:

with Util.Serialize.IO.JSON;
with Util.Serialize.Mappers;

not just

with Util.Serialise;

In that situation, you enable package Utils.Serialize, not the two which you want.

like image 42
thindil Avatar answered Feb 01 '23 19:02

thindil