• 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: importing MyDocument.h compiler errors and warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: importing MyDocument.h compiler errors and warnings


  • Subject: Re: importing MyDocument.h compiler errors and warnings
  • From: Derrek Leute <email@hidden>
  • Date: Tue, 17 Oct 2006 18:09:24 -0400


Yep! That did it.

Is there a basic tutorial documentation that has this kind of information?

I've read a lot of the Objective-c and cocoa basic programming tutorials, and I think I have a strong grasp of design patterns and other issues, but I keep getting stumped by simple things like this.

Thanks!

--Derrek

On Oct 17, 2006, at 5:58 PM, Ivan Kourtev wrote:

Derrek,

If I understand correctly, you have an #import "MyDocument.h" line at the beginning of TreeWrapper.h, correct?

if so, simply replace it with the following line

@class MyDocument;

and continue to iimport "MyDocument.h" in "TreeWrapper.m" file.


Hope this helps,

--
ivan

On Oct 17, 2006, at 5:52 PM, Derrek Leute wrote:


In my objects I need to know the document they belong to. To accomplish this, I created a reference to the currentDocument upon the object initialization. Simplified Code:


@interface TreeWrapper : NSObject
{
	NSDocument *document;
}

- (id) init
{
self = [super init];
if (self != nil) {
document = [[NSDocumentController sharedDocumentController] currentDocument];
}
return self;
}


This works fine except it generates compiler warnings as I try and call methods that are custom to my subclass of NSDocument. The program compiles and runs as expected though.

If I switch it to MyDocument *document I need to also import "MyDocument.h". This causes some sort of error where it can't find the TreeWrapper which is the super class to my data objects.

"error: cannot find interface declaration for 'TreeWrapper', superclass of '(one of my subclasses)'

It generates this for many of my data objects. The problem seems to be that including MyDocument.h reincludes my root data object which is a sub class of TreeWrapper.

Anyone have any ideas?

--Derrek
_______________________________________________
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


_______________________________________________ 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
References: 
 >importing MyDocument.h compiler errors and warnings (From: Derrek Leute <email@hidden>)

  • Prev by Date: Re: NSToolbar with NSSearchField crash
  • Next by Date: Re: multi-threading, AppKit etc
  • Previous by thread: importing MyDocument.h compiler errors and warnings
  • Next by thread: Re: importing MyDocument.h compiler errors and warnings
  • Index(es):
    • Date
    • Thread