Re: #import errors and @class warnings
Re: #import errors and @class warnings
- Subject: Re: #import errors and @class warnings
- From: Andre Doucette <email@hidden>
- Date: Thu, 30 Apr 2009 13:14:15 -0600
Ah, that makes sense. I knew the @class thing was working, but it was
so annoying to never know if the method call was correct or not.
Adding the .h files to the respective .m files fixed the issue though.
Thanks so much!
Andre
On 30-Apr-09, at 11:07 AM, Sherm Pendley wrote:
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