Re: #import errors and @class warnings
Re: #import errors and @class warnings
- Subject: Re: #import errors and @class warnings
- From: Sherm Pendley <email@hidden>
- Date: Thu, 30 Apr 2009 13:07:47 -0400
On Thu, Apr 30, 2009 at 2:55 AM, Andre Doucette <
email@hidden> wrote:
It seems that it doesn't like the double #import, but I thought the whole
> idea behind #import was that it ensured one-time includes.
#import guards against multiple includes, but not circular includes. So you
can't have a.h #import b.h, and b.h #import a.h.
> If I take either #import "NetworkController.h" or #import "AppController.h"
> and change them to forward declarations (that is, @class NetworkController;
> or @class AppController;), this works, but then I get a sprinkling of errors
> everywhere saying that methods may not be implemented.
You're on the right track, but using @class in your header file is only one
of the two necessary steps. The second step is to use #import in your .m
files - i.e. in AppController.m, you would #import "NetworkContoller.h", and
in NetworkController.m, #import "AppController.h".
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden