comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Ada as 2nd Lang, p. 678
Date: 1997/05/02
Date: 1997-05-02T00:00:00+00:00	[thread overview]
Message-ID: <dewar.862575815@merv> (raw)
In-Reply-To: 5k92el$bs9@ultranews.duc.auburn.edu


John asks about

<<I was wondering if anyone could help for a second . . .
Ada as a Second Language (My favorite book) gives this listing
for an example using Generic subprograms, but GNAT complains of end-of-line;
it sees the declaration and stops.
"end of file expected, file can have only one compilation unit>>


The message seems clear enough "file can have only one compilation unit",
means that a single file can contain only one compilation unit, and the
file you submitted contains two. The Ada standard says nothing about files,
or how sources are arranged into files, so this is a place that Ada compilers
may differ (some Ada compilers do allow multiple units in a single file).

Actually it is generally a bad idea to do what you did -- put the spec and
the body in the same unit, because that causes an unnecessary connection
between the two. The whole idea in Ada is to separate the spec and the
body, so putting them in separate files is recommended in any case.

If you are using GNAT, then you can either manually split these into two
files, or use gnatchop to do this for you. You really should read the
GNAT documentation. This and many other interesting and useful things
about GNAT are described there!





  parent reply	other threads:[~1997-05-02  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-01  0:00 Ada as 2nd Lang, p. 678 John M. Greer
1997-04-30  0:00 ` Matthew Heaney
1997-05-02  0:00 ` Robert Dewar [this message]
1997-05-09  0:00   ` nickerson
1997-05-12  0:00 ` Norman H. Cohen
  -- strict thread matches above, loose matches on Subject: below --
1997-05-12  0:00 Marin David Condic, 561.796.8997, M/S 731-93
1997-05-13  0:00 ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox