Re: Newbie #import confusion...
Re: Newbie #import confusion...
- Subject: Re: Newbie #import confusion...
- From: Matt Reagan <email@hidden>
- Date: Wed, 28 Dec 2005 04:23:00 -0800
thank you!
On 12/28/05, email@hidden <email@hidden> wrote:
>
Hi,
>
If you just need that compiler knows your custom class, just replace
>
#import "myheader.h"
>
to
>
@class myclass
>
>
However, if your class needs to know some method or other things of the other
>
class, you have to import and to avoid "circular import", I think (but not
>
sure) you have to use #ifndef....#endif
>
>
Maybe another solution....
>
Regards,
>
Guillaume
>
>
Selon Matt Reagan <email@hidden>:
>
>
> Can anyone please help me out? The answer to this is so amazingly
>
> simple that I can't seem to find it anywhere...
>
>
>
> I have a controller object with an outlet pointing to a NSView
>
> subclass, and that NSView has an outlet pointing back to the
>
> controller. My problem is that because the IBOutlet declartions are
>
> typed to these specific classes, I have to #import each header so the
>
> compiler can see what it needs to compile, but I'm getting some kind
>
> of circular problem where the NSView's source imports the controller's
>
> header, which in turn imports the view's header, and round and round
>
> it goes. So I get a compile error. In the NSView's source code,
>
> changing this declaration:
>
>
>
> IBOutlet myCustomView *theView;
>
>
>
> to this:
>
>
>
> IBOutlet id *theView;
>
>
>
> will allow it to compile, but obviously there must be some way to
>
> avoid this problem without having to get rid of the class typing.
>
>
>
> Can someone shove my nose into the obvious solution for this?
>
>
>
> Thank you all for your help,
>
> -matt
>
> _______________________________________________
>
> Do not post admin requests to the list. They will be ignored.
>
> Cocoa-dev mailing list (email@hidden)
>
> Help/Unsubscribe/Update your Subscription:
>
>
>
> This email sent to email@hidden
>
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden