On Thu, Jun 19, 2008 at 9:36 AM, Martin Häcker <[EMAIL PROTECTED]> wrote: > 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. >
(You presumably mean 'import' rather than 'include' here?) Yes, #import only considers the filename you give it, rather than the fully resolved filepath. > 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. The first is good practice when writing a framework. The second is good practice everywhere. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]