• 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
Re: Syntax error when declaring an IBOutlet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax error when declaring an IBOutlet


  • Subject: Re: Syntax error when declaring an IBOutlet
  • From: David <email@hidden>
  • Date: Thu, 6 Mar 2008 13:44:04 -0500

Whats in World.h?

On Thu, Mar 6, 2008 at 1:16 PM, Mark Teagarden <email@hidden> wrote:

> Hi,
>
> My app has three objects - world, mapview, and game, and they need to know
> about each other in various combinations: mapview needs an outlet to world
> and game, and game needs an outlet to world.  I've ctrl-clicked them all
> together appropriately in IB, and now I'm trying to declare the IBOutlets
> in
> code.  So in mapview.h:
>
> #import <Cocoa/Cocoa.h>
> #import "World.h"
> #import "Game.h"
>
> @interface WMapView : NSView {
>    IBOutlet Game * game;
>    IBOutlet World * world;
>    int view_x, view_y, window;
>
> }
>
> This worked fine and complied correctly.  But the following code
> (identical,
> as far as I can tell) in game.h:
>
> #import <Cocoa/Cocoa.h>
> #import "World.h"
>
> @interface Game : NSObject {
>    IBOutlet World * world;
> }
>
> Throws up: 'syntax error before World' in the IBOutlet statement.  I was
> able to get around this by replacing
>
> #import "World.h"
>
> with
>
> @class World
>
> in game.h.
>
> I have another class, Display, that gives me the same error as the one in
> game.h - I've omitted it here for clarity.  Basically, the mapview.h#import
> / IBOutlet is the only one that worked correctly.
>
> My questions are:
> 1.  Why does identical code work in one file and not in the others?
> 2.  Why should @class work when #import doesn't?  Hillegass flat out says
> that the two are interchangeable.
>
> Thanks,
> Mark
>
>
> _______________________________________________
>
> 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
>
_______________________________________________

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

References: 
 >Syntax error when declaring an IBOutlet (From: Mark Teagarden <email@hidden>)

  • Prev by Date: Creating outlets
  • Next by Date: Re: Interface to shut down cores and/or processors?
  • Previous by thread: Syntax error when declaring an IBOutlet
  • Next by thread: Re: Syntax error when declaring an IBOutlet
  • Index(es):
    • Date
    • Thread