• 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: [newbie] Cyclic #import
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [newbie] Cyclic #import


  • Subject: Re: [newbie] Cyclic #import
  • From: Thomas Davie <email@hidden>
  • Date: Wed, 8 Dec 2004 04:20:19 +0000

On 8 Dec 2004, at 04:13, King Chung Huang wrote:

In your header (.h) files, you can just prototype the class, then import the actual header in your implementation (.m) files as needed.

For example, in MyController.h, you would write:

#import <Cocoa/Cocoa.h>

@class MyNetworker;

@interface MyController : NSObject {
	IBOutlet MyNetworker *networker;
}

A good tip here is to have a generic header file that you include from all your .m files. This file contains something along the lines of:


#import "Something1.h"
#import "SomethingElse.h"

etc for each of your classes.

This way you don't need to worry about getting your header imports in the correct order in each of your .m files, you just need to include your project.h file.

This can lead to a lot of extra code being included in each .m file, but the gnu C compiler has a dead code stripper IIRC so it should strip out all of this extra code.

Bob

_______________________________________________
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


  • Follow-Ups:
    • Re: [newbie] Cyclic #import
      • From: Malte <email@hidden>
References: 
 >[newbie] Cyclic #import (From: Malte <email@hidden>)
 >Re: [newbie] Cyclic #import (From: King Chung Huang <email@hidden>)

  • Prev by Date: Re: Object-C question #1
  • Next by Date: Re: delay function
  • Previous by thread: Re: [newbie] Cyclic #import
  • Next by thread: Re: [newbie] Cyclic #import
  • Index(es):
    • Date
    • Thread