comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Protected Type compiler complaint
Date: Mon, 07 Jul 2014 08:55:24 +0100
Date: 2014-07-07T08:55:24+01:00	[thread overview]
Message-ID: <lyk37peh77.fsf@pushface.org> (raw)
In-Reply-To: e17758fe-b230-4ef6-b144-d5a68e821915@googlegroups.com

NiGHTS <nights@unku.us> writes:

> When I compile it complains that "protected declaration cannot be used
> as compilation unit" on line 1 of test.ads. So I remove those files
> from the project source files options menu. Then when I compile again
> it complains about "test.ads not found" on line 3 of main.adb.

A protected declaration cannot be used as a compilation unit; it has to
be declared within one.

> Here is a summarized view of what my test.ads looks like:
>
>    protected type Test is procedure DoSomething; end Test;

   package Test is
      protected type P is
        procedure Do_Something;
      end P;
   end Test;

> And here is a summarized view of what my main.adb looks like:
>
>    with Test; use Test;
>
>    procedure main is begin Test.DoSomething; end;

You made Test a protected *type* (and I've suggested Test.P), so you
need to declare a protected *object* of that type.

   with Test;
   procedure Main is
      O : Test.P;
   begin
      O.Do_Something;
   end Main;


  reply	other threads:[~2014-07-07  7:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07  7:15 Protected Type compiler complaint NiGHTS
2014-07-07  7:55 ` Simon Wright [this message]
2014-07-07 14:23   ` NiGHTS
2014-07-07 16:37     ` Adam Beneschan
2014-07-07 17:21     ` Simon Wright
2014-07-08 17:03     ` Shark8
2014-07-08 17:50       ` Anh Vo
2014-07-07 19:06 ` framefritti
2014-07-08  7:11   ` Georg Bauhaus
2014-07-08  7:53   ` Dmitry A. Kazakov
replies disabled

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