Hey guys, I'm just starting out with Cocoa and I'm trying to make a basic GUI calculator app. My problem is that whenever I compile, I get an error saying:
error: parse error before '=' token
It's referring to line 5 of the CSController.h file. Here's all the code:
CSController.h:
CSController.m
And my main.m which I haven't modified:
Thanks.
error: parse error before '=' token
It's referring to line 5 of the CSController.h file. Here's all the code:
CSController.h:
Code:
#import <Cocoa/Cocoa.h>
@interface CSController : NSObject
{
NSMutableString *contents = [NSMutableString stringWithCapacity:10];
IBOutlet NSTextField *textField;
IBOutlet NSTextView *textView;
}
- (IBAction)clear:(id)sender;
- (IBAction)divide:(id)sender;
- (IBAction)dot:(id)sender;
- (IBAction)eight:(id)sender;
- (IBAction)enter:(id)sender;
- (IBAction)equals:(id)sender;
- (IBAction)five:(id)sender;
- (IBAction)four:(id)sender;
- (IBAction)minus:(id)sender;
- (IBAction)multiply:(id)sender;
- (IBAction)nine:(id)sender;
- (IBAction)one:(id)sender;
- (IBAction)plus:(id)sender;
- (IBAction)seven:(id)sender;
- (IBAction)six:(id)sender;
- (IBAction)three:(id)sender;
- (IBAction)two:(id)sender;
- (IBAction)zero:(id)sender;
@end
CSController.m
Code:
#import "CSController.h"
@implementation CSController
- (IBAction)clear:(id)sender
{
}
- (IBAction)divide:(id)sender
{
}
- (IBAction)dot:(id)sender
{
}
- (IBAction)eight:(id)sender
{
[contents appendString:@"8"]
[textField setStringValue:contents]
}
- (IBAction)enter:(id)sender
{
}
- (IBAction)equals:(id)sender
{
}
- (IBAction)five:(id)sender
{
}
- (IBAction)four:(id)sender
{
}
- (IBAction)minus:(id)sender
{
}
- (IBAction)multiply:(id)sender
{
}
- (IBAction)nine:(id)sender
{
}
- (IBAction)one:(id)sender
{
}
- (IBAction)plus:(id)sender
{
}
- (IBAction)seven:(id)sender
{
}
- (IBAction)six:(id)sender
{
}
- (IBAction)three:(id)sender
{
}
- (IBAction)two:(id)sender
{
}
- (IBAction)zero:(id)sender
{
}
@end
And my main.m which I haven't modified:
Code:
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
Thanks.