• 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
RS: declaration bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RS: declaration bug


  • Subject: RS: declaration bug
  • From: Roland Silver <email@hidden>
  • Date: Wed, 22 Aug 2007 20:32:16 -0600

In the two skeleton classes defined below, I get an error message flagged for the second line of Foo.m:
#include "Foo.h"
error: cannot find interface declaration for 'Foo', superclass of 'Bar'


If I comment out that line, I get both an error message and a warning on the fourth line:
error: parse error before 'Bar'
warning: cannot find interface declaration for 'Foo'


But Bar needs to know about its superclass, Foo, and Foo needs to know about Bar because of the declaration (and definition) of its bar method.

So how do I handle this?
---------------------------------------------------
//  Foo.h
#import <Cocoa/Cocoa.h>
#import "Bar.h"
@interface Foo : NSObject {}
- (Bar*) bar;
@end

//  Foo.m
#import "Foo.h"
@implementation Foo
- (Bar*) bar {
  Bar* aBar;
  return aBar; }
@end

//  Bar.h
#import <Cocoa/Cocoa.h>
#import "Foo.h"
@interface Bar : Foo {}
@end

//  Bar.m
#import "Bar.h"
@implementation Bar
@end
---------------------------------------------------

-- Roland Silver <email@hidden>



_______________________________________________

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: RS: declaration bug
      • From: mmalc crawford <email@hidden>
  • Prev by Date: How to get selection of submenu
  • Next by Date: Re: RS: declaration bug
  • Previous by thread: Re: How to get selection of submenu
  • Next by thread: Re: RS: declaration bug
  • Index(es):
    • Date
    • Thread