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.2 required=5.0 tests=BAYES_00,FROM_NUMERIC_TLD, INVALID_MSGID,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9c8533728e8d73d0 X-Google-Attributes: gid103376,public From: steved@199.2.117.161 (Steve Doiel) Subject: Re: Please help a beginner! (second try) Date: 1996/02/18 Message-ID: <4g675n$dm4@news.pacifier.com>#1/1 X-Deja-AN: 139884364 references: <4g517q$438@helios.herts.ac.uk> organization: Pacifier BBS, Vancouver, Wa. ((360) 693-0325) reply-to: steved@pacifier.com (Steve Doiel) newsgroups: comp.lang.ada Date: 1996-02-18T00:00:00+00:00 List-Id: In <4g517q$438@helios.herts.ac.uk>, kst1ju@herts.ac.uk (Ryan) writes: > >Could somebody please help me with what I am sure is a simple >problem. I need to do some basic text and integer IO. Apparently >I need the TEXT_IO library for this - it is on my system, and >I believe I am using it in the following code. However, when I >compile the program, the errors mentioned in the comments are >given out : > >with TEXT_IO; >package INT_IO is new TEXT_IO.INTEGER_IO(INTEGER); >with INT_IO; > >procedure proc1 is >begin > TEXT_IO.PUT("Hello"); >-- fails ... "TEXT_IO not defined" > INT_IO.PUT(2); >-- accepted >end proc1; > >procedure main is >begin > TEXT_IO.PUT("Hello"); >-- fails ... "TEXT_IO not defined" > INT_IO.PUT(2); >-- fails ... "INT_IO not defined" >end main; > > [snip] > Thanks, > > Nigel. I too come from a Pascal background and have shifted toward Ada. I did some slight re-arranging of your code, and the following compiles and runs under GNAT 3.01 on OS/2. It may not be exactly what you wanted, but it gives the output: Hello 2 with TEXT_IO; procedure main is package INT_IO is new TEXT_IO.INTEGER_IO(INTEGER); procedure proc1 is begin TEXT_IO.PUT("Hello"); INT_IO.PUT(2); end proc1; begin TEXT_IO.PUT("Hello"); INT_IO.PUT(2); end main; In simple terms, the main program in Pascal is something like: PROGRAM Main( input, output ); BEGIN END. Well, in Ada the main program is a procedure: PROCEDURE Main IS BEGIN END Main; All the WITH's go before the main procedure heading. Hope this helps! Steve Doiel