Newbie: Include file Loop!
Newbie: Include file Loop!
- Subject: Newbie: Include file Loop!
- From: Jay Prince <email@hidden>
- Date: Tue, 24 Sep 2002 14:17:06 -0700
I've got a situation that I'm sure is from stupidity on my part.
I've got two objects: Foo and Bar. Each wants a pointer to the other
so they can send messages back and forth. They are truly peers and
need to send multiple messages back and forth.
I have:
#import "Bar.h"
@interface Foo : NSObject
Bar * myBar;
@end
#import "Foo.h"
@interface Bar: NSObject
Foo * my Foo;
@end
So, of course when building I get:
Foo.h:18: undefined type, found `Bar'
from Foo.m:10:
In file included from Bar.h:4,
Foo.h:18: parse error before "Bar"
Neither header can be compiled because it depends on the other, and
when the compiler gets to the part of a header referencing the other
header (in the process of processing the other header) it chokes.
Is there a solution to this, or do I just need to call them ids and get
on with my life?
Jay
PS I was unable to find this on masam, but given its nature it's a
difficult search.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.