我有Windows 10 64bit,我安装了GNAT编程工作室(没有像java jdk那样设置)。我想在GPS GNAT编程工作室制作我的第一个Ada程序。
根据此example,以下是Arrayproject.adb
:
with Ada.Text_IO;
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
use Ada.Text_IO;
procedure Arrayproject is
type MyArray is array (1 .. 16) of Integer;
procedure put(s: MyArray) is
begin
for i in s'range loop
Put (s(i), Width =>4);
end loop;
new_line;
end put;
s: MyArray := (11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
d: MyArray := s;
begin
put_Line ("Chunks of source Array");
put(s);
put_Line ("Chunks of destination of array");
d(1 .. 4) :=s(9 .. 12);
d(5 .. 8) :=s(1 .. 4);
d(9 .. 12) :=s(13 .. 16);
d(13 .. 16) :=s(5 .. 8);
put (d);
end Arrayproject;
这段代码在网上Ada编译器编译得很好,但我不知道如何在GNAT编程工作室中使用它。错误即将到来,没有为该项目定义语言。
以下是khurram.gpr。请帮我制作gpr和编译。
Project Khurram is
for Source_Dirs use ("src");
for Object_Dir use "obj";
for Main use ("Arrayproject.adb");
end Khurram;
答案 0 :(得分:5)
在.gpr文件中定义一种语言:
for Languages use ("Ada");