• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: #import errors and @class warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: #import errors and @class warnings
      • From: Andre Doucette <email@hidden>
References: 
 >#import errors and @class warnings (From: Andre Doucette <email@hidden>)

  • Prev by Date: Re: Crashing resetting or releasing an NSManagedObjectContext
  • Next by Date: Re: Why is NSString->FSRef so hard?
  • Previous by thread: Re: #import errors and @class warnings
  • Next by thread: Re: #import errors and @class warnings
  • Index(es):
    • Date
    • Thread