re:[newbie] Cyclic #import
re:[newbie] Cyclic #import
- Subject: re:[newbie] Cyclic #import
- From: Christopher Drum <email@hidden>
- Date: Tue, 7 Dec 2004 21:46:22 -0800
Seems to me that what you are looking for in this case is "@class".
Remember, you don't necessarily need to #import the full header file for a custom class. In your example, you simply need to declare it.
So, instead of...
#import <Cocoa/Cocoa.h>
#import "MyNetworker.h"
@interface MyController : NSObject
{
IBOutlet MyNetworker * networker;
}
you would write something like this...
#import <Cocoa/Cocoa.h>
@class MyNetworker;
@interface MyController : NSObject
{
IBOutlet MyNetworker *networker;
}
Now, the MyNetworker class is understood enough to reference your instance variable without getting into the cyclic nature of the multiple #imports. Plus, since you're not importing the full .h file, your builds should be a little faster (depending upon the length and complexity of such).
Hope this helps!
------------------------------------------------------------------
Christopher Drum
http://homepage.mac.com/christopherdrum
Check out FileWrangler, my five-star rated (MacUpdate, VersionTracker) Cocoa app written in Objective-C for the batch renaming of files.
_______________________________________________
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