我正在尝试编写以下程序:
with Ada.Text_IO;
procedure Main is
type T is range 0 .. 18;
package IO is new Ada.Text_IO.Integer_IO (T);
begin
IO.Put (1);
end Main;
但是当我尝试编译时,我收到以下错误消息:
main.adb:6:04: info: in instantiation at a-tiinio.ads:51 main.adb:6:04: info: "IO" requires body ("Get" requires completion) main.adb:6:04: info: in instantiation at a-tiinio.ads:56 main.adb:6:04: info: "IO" requires body ("Get" requires completion) main.adb:6:04: info: in instantiation at a-tiinio.ads:60 main.adb:6:04: info: "IO" requires body ("Put" requires completion) main.adb:6:04: info: in instantiation at a-tiinio.ads:66 main.adb:6:04: info: "IO" requires body ("Put" requires completion) main.adb:6:04: info: in instantiation at a-tiinio.ads:71 main.adb:6:04: info: "IO" requires body ("Get" requires completion) main.adb:6:04: info: in instantiation at a-tiinio.ads:76 main.adb:6:04: info: "IO" requires body ("Put" requires completion) a-tiinio.adb:59:07: (style) maximum nesting level exceeded a-tiinio.adb:79:07: (style) maximum nesting level exceeded a-tiinio.adb:100:07: (style) maximum nesting level exceeded a-tiinio.adb:121:07: (style) maximum nesting level exceeded a-tiinio.adb:134:07: (style) maximum nesting level exceeded a-tiinio.adb:147:07: (style) maximum nesting level exceeded
据我在本手册的A.10.8部分所理解,Integer_IO
是一个通用包,需要使用有符号整数进行实例化。我也试过了subtype T is Integer
或Positive
,但我得到了同样的错误。
我做错了什么?
答案 0 :(得分:2)
似乎你在编译器开关“-gnatyL”提供的样式检查中设置了不适当的最大嵌套级别,然后将编译器设置为通过“-gnatwe”开关将所有警告和样式检查视为错误。
答案 1 :(得分:0)
您的编译器安装可能存在问题。我可以使用$AppNames = Get-Webapplication -Site "Mgmtservice" | ForEach-Object { $_.Path.Trim('/')}
$AppNames | ForEach-Object { Remove-WebApplication -Name $_ -Site MgmtService }
Start-Sleep 6
$AppNames | ForEach-Object { ConvertTo-WebApplication -PSPath (Join-Path 'IIS:\Sites\Mgmtservice\' $_) }
构建代码而不会出现问题。你在命令行或任何IDE中使用gnatmake吗?
无论如何,我会建议你以下......
您可以使用包" Ada.Integer_Text_IO",例如:
gnatmake main.adb
现在您可以致电:with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
这可能是放置整数的最舒服方式!