是什么导致我的程序出现此错误:预期私有类型 "Ada.Strings.Unbounded.Unbounded_String"

What is causing this error in my program: expected private type "Ada.Strings.Unbounded.Unbounded_String"

在下面的程序中,我想创建一个 nameBook,它是一个字符串数组,这样我就可以存储 5 个名字。您可以在下面看到我是如何做到的。当我尝试编译时,出现如下所示的错误。这里的问题是什么?

with ada.integer_text_io; use ada.integer_text_io;
with ada.text_io; use ada.text_io;
with ada.strings.unbounded; use ada.strings.unbounded;

procedure nameStorer is

nameBook : array(1..5) of unbounded_string; 

begin
nameBook := ("tom","mary","harry","william","kate");

end nameStorer; 

编译错误:

nameStorer.adb:10:16: expected private type "Ada.Strings.Unbounded.Unbounded_String"
nameStorer.adb:10:16: found a string type
nameStorer.adb:10:24: expected private type "Ada.Strings.Unbounded.Unbounded_String"
nameStorer.adb:10:24: found a string type
nameStorer.adb:10:33: expected private type "Ada.Strings.Unbounded.Unbounded_String"
nameStorer.adb:10:33: found a string type
nameStorer.adb:10:40: expected private type "Ada.Strings.Unbounded.Unbounded_String"
nameStorer.adb:10:40: found a string type
nameStorer.adb:10:47: expected private type "Ada.Strings.Unbounded.Unbounded_String"
nameStorer.adb:10:47: found a string type

"tom","mary","harry","william","kate"String 类型的文字(准确地说是 Standard.String)。您的 nameBookUnbounded_String (Ada.Strings.Unbounded.Unbounded_String) 类型的数组。您需要将字符串文字转换为 Unbounded_Strings。

Ada.Strings.Unbounded (RM A.4.5/9)

中查看To_Unbounded_String