comp.lang.ada
 help / color / mirror / Atom feed
From: "jimmaureenrogers@worldnet.att.net" <jimmaureenrogers@worldnet.att.net>
Subject: Re: how to create a record
Date: 2 Nov 2006 21:00:16 -0800
Date: 2006-11-02T21:00:16-08:00	[thread overview]
Message-ID: <1162530016.834885.183860@f16g2000cwb.googlegroups.com> (raw)
In-Reply-To: 1162523698.802339.225760@h54g2000cwb.googlegroups.com

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




  parent reply	other threads:[~2006-11-03  5:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-03  3:14 how to create a record markww
2006-11-03  4:48 ` Jeffrey Creem
2006-11-03  5:29   ` Jeffrey R. Carter
2006-11-03  7:51   ` Maciej Sobczak
2006-11-03  5:00 ` jimmaureenrogers [this message]
2006-11-03  5:19 ` Jeffrey R. Carter
2006-11-03 11:51 ` Martin Krischik
2006-11-03 16:56 ` Pascal Obry
2006-11-04  3:09   ` Randy Brukardt
replies disabled

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