Hey everyone,
I got this really confusing (for me, at least) issue where I have two Obj-C classes that need to use each other. Here's some examples
and file:
Both of them require importing the header file of the other object, but Obj-C won't let me do this, and at line "HERE" I get the error "syntax error before 'BObj'."
If someone could enlighten me on how to import both headers without getting stuck importing in a circle, that would be useful. I also tried putting the BObj into the global scope, but I guess I don't know how to do that. Any help would be helpful!
I got this really confusing (for me, at least) issue where I have two Obj-C classes that need to use each other. Here's some examples
Code:
// file AObj.h
#import <Cocoa/Cocoa.h>
#import "BObj.h"
@interface AObj : NSObject {
BObj *b;
}
-(void) setBObj:(BObj *) b; // HERE
and file:
Code:
// file BObj.h
#import <Cocoa/Cocoa.h>
#import "AObj.h"
@interface BObj : NSObject {
AObj *a;
}
Both of them require importing the header file of the other object, but Obj-C won't let me do this, and at line "HERE" I get the error "syntax error before 'BObj'."
If someone could enlighten me on how to import both headers without getting stuck importing in a circle, that would be useful. I also tried putting the BObj into the global scope, but I guess I don't know how to do that. Any help would be helpful!