From: "A. Cervetti" <andrea.cervetti@gmail.com>
Subject: Re: simple code can't compiled, without clear compiler warning (not clear enough to me at least)
Date: Wed, 29 Nov 2017 08:11:25 -0800 (PST)
Date: 2017-11-29T08:11:25-08:00 [thread overview]
Message-ID: <057fe438-12be-453e-a388-8522e38747f8@googlegroups.com> (raw)
In-Reply-To: <e4148718-aad2-4802-b7cf-ea76ceb04472@googlegroups.com>
wednesday 29 november 2017 16:17:03 UTC+1, Mehdi Saada wrote:
> $ gcc-6 -c tri_selection.ads
> cannot generate code for file tri_selection.ads (package spec)
> gnatmake: "tri_selection.ads" compilation error
>
> I thought specifications could be compiled separately ?
Yes, they can, but for syntax check only. They cannot generate code (like explained in the message).
try: gcc-6 -gnats -c tri_selection.ads
>
> the body can't compiled either.
> gcc-6 -c tri_selection.adb
> tri_selection.adb:7:35: expected type "Indice_type" defined at tri_selection.ads:3
> tri_selection.adb:7:35: found type "Element_type" defined at tri_selection.ads:2
> tri_selection.adb:8:27: expected type "Indice_type" defined at tri_selection.ads:3
> tri_selection.adb:8:27: found type "Element_type" defined at tri_selection.ads:2
> tri_selection.adb:8:35: expected type "Indice_type" defined at tri_selection.ads:3
> tri_selection.adb:8:35: found type "Element_type" defined at tri_selection.ads:2
> tri_selection.adb:9:27: expected type "Indice_type" defined at tri_selection.ads:3
> tri_selection.adb:9:27: found type "Element_type" defined at tri_selection.ads:2
> tri_selection.adb:9:35: expected type "Indice_type" defined at tri_selection.ads:3
> tri_selection.adb:9:35: found type "Element_type" defined at tri_selection.ads:2
> tri_selection.adb:19:33: expected type "Element_type" defined at tri_selection.ads:2
> tri_selection.adb:19:33: found type "Indice_type" defined at tri_selection.ads:3
> gnatmake: "tri_selection.adb" compilation error
I think that the message are enough self explicative.
You defined the parameters A and B as Element_Type:
> procedure Swap (T: in out Tableau_type; A, B : in out Element_type)
than you used them as indexes:
> temp := T(A);
> T(A) := T(B);
the indexes should be Indice_type.
also you called Swap with the actual parameter temp and Tableau_type'Last
that are Index_type.
redefine Swap as
procedure Swap (T: in out Tableau_type; A, B : in out indice_type)
Now there are other errors, but I'll leave to you the pleasure of discovery.
A.
next prev parent reply other threads:[~2017-11-29 16:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 15:17 simple code can't compiled, without clear compiler warning (not clear enough to me at least) Mehdi Saada
2017-11-29 15:48 ` pascal.malaise
2017-11-29 16:11 ` A. Cervetti [this message]
2017-11-29 17:27 ` Mehdi Saada
2017-11-29 18:37 ` AdaMagica
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox