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-Thread: 103376,ebe6e2ef707c0384 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!f16g2000cwb.googlegroups.com!not-for-mail From: "jimmaureenrogers@worldnet.att.net" Newsgroups: comp.lang.ada Subject: Re: how to create a record Date: 2 Nov 2006 21:00:16 -0800 Organization: http://groups.google.com Message-ID: <1162530016.834885.183860@f16g2000cwb.googlegroups.com> References: <1162523698.802339.225760@h54g2000cwb.googlegroups.com> NNTP-Posting-Host: 69.170.65.169 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1162530024 15047 127.0.0.1 (3 Nov 2006 05:00:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 3 Nov 2006 05:00:24 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: f16g2000cwb.googlegroups.com; posting-host=69.170.65.169; posting-account=SqOfxAwAAAAkL81YAPGH1JdBwpUXw9ZG Xref: g2news2.google.com comp.lang.ada:7340 Date: 2006-11-02T21:00:16-08:00 List-Id: markww wrote: > Hi, > > How can I define a record or a class to this source file and create an > instance of it? > > with Ada.Text_IO; > > type struct_device is > record > major_number : Integer := 0; > minor_number : Integer := 0; > end record; > > procedure Ada_LinkedList is > begin > Ada.Text_IO.Put_Line("Hello, world!"); > Ada.Text_IO.Put_Line("just terrible!"); > end Ada_LinkedList; > The error message is correct. You are attempting to create a type outside any compilation unit. You need to either move the record definition within the procedure, or create a package containing the record. If you move the record definition within the procedure it will look like this: with Ada.Text_IO; procedure Ada_Linked_List is type Struct_Device is record Major_Number : Integer := 0; Minor_Number : Integer := 0; end record; begin Ada.Text_IO.Put_Line("Hello World!"); Ada.Text_IO.Put_Line("just terrible!"); end Ada_Linked_List; Jim Rogers