Package error

I have problems with package visibility. I have a really simple package and the code is below. The error message is shown here:

viterbi.adb:12:14: "Integer_Text_IO" is not visible (more references follow)
viterbi.adb:12:14: non-visible declaration at a-inteio.ads:18
gnatmake: "viterbi.adb" compilation error

The package specification is as follows:

package Viterbi is

  procedure Load_N_File(
    Filename : in String;
    N : in out Integer;
    M : in out Integer);

end Viterbi;

The body of the package is as follows:

with Ada.Integer_Text_IO; use with Ada.Integer_Text_IO;
with Ada.Strings; use Ada.Strings;

package body Viterbi is

  procedure Load_N_File(
    Filename : in String;
    N : in out Integer;
    M : in out Integer
  ) is
    N_File : File_Type;
  begin
    Open( N_File, Mode=>In_File, Name=>Filename );
    Get( N_File, N ); 
    Get( N_File, M );
    Close( N_File ); 
  end Load_N_File;

end Viterbi;

What in my package body causes the package to remain hidden? Shouldn't the use Integer_Text_IO clause be used?

+3
source share
2 answers

The package body code, as indicated, has a syntax error: false "c" in "use with Ada.Integer_Text_IO;" paragraph.

Having fixed this, I then get compilation errors revolving around the inability to allow File_Type, Open and Close. Adding "c" and "using" Ada.Text_IO gives me a clean compilation.

, :

with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Strings; use Ada.Strings;
with Ada.Text_IO; use Ada.Text_IO;

package body Viterbi is
   ...

- " Integer_Text_IO" , , .. ?

+4

"use with", , , :      - ,   Ada.Integer_Text_IO,   Ada.Strings;

Use
-- Testing,
Ada.Strings,
Ada.Integer_Text_IO;

"withs" "usues", .

+2

Source: https://habr.com/ru/post/1790090/


All Articles