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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dbcd0557f06cdbfa X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-14 22:59:03 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!dispose.news.demon.net!news.demon.co.uk!demon!pogner.demon.co.uk!zap!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Only one compilation unit. Date: 13 Jul 2001 20:08:33 +0100 Organization: CodeFella Message-ID: References: <3B497F21.8CD784D8@brighton.ac.uk> NNTP-Posting-Host: localhost X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 X-Trace: news.demon.co.uk 995176739 nnrp-02:18987 NO-IDENT pogner.demon.co.uk:158.152.70.98 X-Complaints-To: abuse@demon.net NNTP-Posting-Date: 13 Jul 2001 19:08:33 GMT X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:9968 Date: 2001-07-13T19:08:33+00:00 List-Id: John English writes: > McDoobie wrote: > > > > Alright, I'm writing a small program using two procedures. > > > > Now I'm coding both procedures within the same .adb file. When I go to > > compile the program I get an error that says "end of file expected, can > > only have one compilation unit." > > > > Now, that only happens when writing programs with more than one procedure. > > > > Do I have to put each different procedure in a seperate text file? > > For GNAT, yes. > > Simple solution: if you have x.adb containing procedure Main and > procedure Sub, run "gnatchop x.adb" which will split the procedures > into separate files called main.adb and sub.adb, then run "gnatmake > main.adb" which will compile Main and any other units that it > depends on (in this case, Sub). Note that Main will need to say > "with Sub;" at the top... It's probably a good idea to name the file containing your source using a file extension other than .adb or .ads (or .adp or .adc, in case you take up extended features later). I'd use .ada We had fun when the source was called Foo.ads, under NT one of the split files ended up also called Foo.ads -- which overwrote our original. Also, GNAT does *not* like files with upper-case letters in the name at all!