advertisement

Article:
  Giving the Simple Text Editor 'Legs'
Subject:   Can't Run
Date:   2004-10-13 15:23:08
From:   ctatar
Response to: Can't Run


I am using Xcode 1.1 in OS X 10.3.5, and I had nearly the same problem. After attempting to build & run, I got one


error: parse error before "NSData"


followed by four


error: parse error before '{' token.


When I double-clicked on the first error message, it took me to MyDocument.h. After comparing this to some of the files in FoundationFramework/Headers (such as NSBundle.h), I saw that all the variable declarations in the pre-made files ended in semicolons. Unfortunately, this was not made clear in the article. The code in MyDocument.hshould look something like this:


#import <Cocoa/Cocoa.h>


@interface MyDocument : NSDocument
{id IBOutlet textView;
NSData *fileData;
}
@end


After adding the semicolons, my code compiled with no problems. I composed, saved, and re-opened this message in the resulting program.