“无选择器”是什么意思?

Ogr*_*gre 2 ada

我收到以下编译器错误:

time_types.ads:99 处未定义类型“Timestamp_Record_Type”的选择器“Put_Timestamp”

给出错误的代码行是:

Timestamp.Put_Timestamp(Trs_Time);
Run Code Online (Sandbox Code Playgroud)

该项目中的 Timestamp 和 Time_Types 包是在错误所在的同一文件的顶部导入的:

with Timestamp;
with Time_Types;
Run Code Online (Sandbox Code Playgroud)

timestamp.ads 包含以下内容:

with Ada.Calendar;

with Time_Types;


package Timestamp is


   function Calculate_Ada_Timestamp( Timestamp_Value : in Time_Types.Timestamp_Time_Type )
    return Ada.Calendar.Time;



  procedure Put_Timestamp
    (Timestamp: in Time_Types.Timestamp_Record_Type);

end Timestamp;
Run Code Online (Sandbox Code Playgroud)

起初我认为这个错误一定意味着带有 Timestamp_Record_Type 类型参数的 Put_Timestamp 不存在,但根据上面的代码,显然情况并非如此。

我缺少什么?

Kei*_*son 5

time_types.ads:99 处未定义类型“Timestamp_Record_Type”的选择器“Put_Timestamp”

(强调已添加。)

Timestamp您已经向我们展示了作为包的声明,但编译器显然认为这Timestamp是类型的表达式(大概是变量名)Timestamp_Record_Type

在您没有向我们展示的代码中的某个地方,我认为您已经声明了一个名为Timestamptype 的变量Timestamp_Record_Type,并且编译器正在寻找.Put_Timestamp可以应用于该类型的变量。

我建议你过度使用这个名字Timestamp;您对过程的参数使用相同的名称Put_Timestamp。也许Timestamps这个包的名字会更好。