Ada - 找不到“check_positive.adb”的图书馆信息

问题描述 投票:0回答:1

我必须学习阿达,所以我可以为它写一个翻译。但我找不到很多学习语言的资源。尝试编译以下代码时,我收到上述消息:我将文件保存为check_positive.adb。我该怎么办?我跑了gnatls Check_Positive.adb后跑了gnatchop -w Check_Positive.adb。我正在使用GNAT Community v5.1.0。

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

procedure Check_Positive is
   N : Integer;
begin
   Put ("Enter an integer value: ");  -- Put a String
   Get (N);  --  Read in an integer value
   if N > 0 then
      Put (N);  --  Put an Integer
      Put_Line (" is a positive number");
   end if;
end Check_Positive;
ada gnat
1个回答
3
投票

gnatlsgnatchop不会编译你的代码,你应该尝试gnatmake

gnatmake check_positive.adb

请注意,GNAT期望每个文件使用小写文件名和一个过程/函数/包规范/包体。如果以这种方式组织代码,则不需要gnatchop。

© www.soinside.com 2019 - 2024. All rights reserved.