AWS安装问题:Ada语言

3

今晚我第一次在Macbook上安装了Ada和AWS。

安装过程中一切似乎都很成功,但我有一种AWS没有安装到正确目录的感觉。

GNAT位于/usr/local/gnat。

AWS的makefile.conf上写着:

AWS will be installed under $(prefix). Update this variable to point to
the install directory. By default, it is set to the current GNAT root
directory to have AWS project files automatically available.

所以我没有改变目标。
但是当我尝试从系统的任何位置编译hello_world时,除了AWS演示文件夹之外,我会收到以下错误信息:
~/projects/ada:gnatmake hello.adb
gcc -c hello.adb
hello.adb:1:06: file "aws.ads" not found
hello.adb:2:06: file "aws.ads" not found
hello.adb:3:06: file "aws.ads" not found
hello.adb:4:06: file "aws.ads" not found
gnatmake: "hello.adb" compilation error

我该如何确保AWS已经正确安装,或者如果没有安装成功,如何移除它?

1个回答

6
答案(对于了解的人而言更像是提示)在“自动提供AWS项目文件”这句话中。
在GNAT环境中,“项目文件”指的是一种类型为.gpr的文件,它告诉构建器(gnatmakegprbuild)在哪里找到源文件,如何编译它们以及在哪里找到任何“此”项目所依赖的库。
创建hello.gpr:
with "aws";
project Hello is
   for Main use ("hello.adb");
end Hello;

如果你的代码库非常小,那么就可以使用一个非常轻量级的框架(这是非常重要的),然后...
with AWS;
with Ada.Text_IO;
procedure Hello is
begin
   Ada.Text_IO.Put_Line ("AWS version is " & AWS.Version);
end Hello;

编译器版本:

gprbuild -P hello.gpr

输出

AWS version is 2.10.0w

有关gprbuildgnatmake的在线信息可在以下链接中找到:gprbuildgnatmakegnatmake已被gprbuild取代),你的GNAT安装目录下 (子目录)${prefix}/share/doc 也可能包含相关信息。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接