• 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
#import importing twice?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

#import importing twice?


  • Subject: #import importing twice?
  • From: Martin Häcker <email@hidden>
  • Date: Thu, 19 Jun 2008 10:36:41 +0200

Hi guys,

I was today stung by a problem that I couldn't quite understand.

I was importing a header file with #import and the compiler complained about a duplicate interface declaration of the class defined in the header file.

Which was bullshit, because the class was only defined in that header file - and #import was supposed to shield me from importing that file more than once.

Doh.

My Problem is, that I couldn't finde a comprehensive documentation on how #import is supposed to work, besides of the "it only imports a header once" from [1].

So why did this happen? Where can I find documentation on this?

The only thing that I found is that this was all happening in a Framework and that the header file was included with #include "filename.h" once and with #include <frameworkname/filename.h> somewhere else.

But even then - it's still the same file (and how am I supposed to reference the file from internal and public headers in the framework anyway?)

Well, thanks a bunch,
Martin

p.s.: I was able to solve this in two ways, first by switching to #import <framworkname/filename.h> everywhere and then by removing the import statements from the headers alltogether and replacing them by @class declarations.

[1] http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_950_section_4.html#/ /apple_ref/doc/uid/TP30001163-CH3-TPXREF103
_______________________________________________


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: #import importing twice?
      • From: "Jonathan del Strother" <email@hidden>
  • Prev by Date: Converting HID keyboards usages to characters ?
  • Next by Date: Re: #import importing twice?
  • Previous by thread: Re: Converting HID keyboards usages to characters ?
  • Next by thread: Re: #import importing twice?
  • Index(es):
    • Date
    • Thread