From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.0.21 with SMTP id 21mr4178595ita.13.1511971885955; Wed, 29 Nov 2017 08:11:25 -0800 (PST) X-Received: by 10.157.33.82 with SMTP id l18mr74276otd.6.1511971885805; Wed, 29 Nov 2017 08:11:25 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!193no780930itr.0!news-out.google.com!193ni1202iti.0!nntp.google.com!i6no785094itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 29 Nov 2017 08:11:25 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=212.45.154.1; posting-account=fEeJQAoAAABLcKAvkveW1ca-ReZJoaMK NNTP-Posting-Host: 212.45.154.1 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <057fe438-12be-453e-a388-8522e38747f8@googlegroups.com> Subject: Re: simple code can't compiled, without clear compiler warning (not clear enough to me at least) From: "A. Cervetti" Injection-Date: Wed, 29 Nov 2017 16:11:25 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49250 Date: 2017-11-29T08:11:25-08:00 List-Id: 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.