image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
Thread Tools
  #1  
Old April 27th, 2008, 06:47 AM
Registered User
 
Join Date: Apr 2008
Posts: 3
jamesrichie54 is on a distinguished road
cocoa help

hello my name is james and im just starting out as a programmer and so far i ve programed two apps thi being my second and ive encountered a problem

#import "AppController.h"

@implementation AppController
- (IBAction)add3id)sender {
[textBox1 setIntValue:[textBox1 intValue] + 3];
}

- (IBAction)subtract3id)sender {
[textBox1 setIntValue:[textBox1 intValue] - 3];
}
@end
it says theres a syntax error after { but i see no problem
could you guys help me out thanks
Reply With Quote
  #2  
Old April 27th, 2008, 11:57 AM
Viro's Avatar
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 2,452
Viro will become famous soon enoughViro will become famous soon enough
There are two "{" characters. Which one triggers the syntax error? Can you post the contents of your header file too?
Reply With Quote
  #3  
Old April 28th, 2008, 02:00 AM
Registered User
 
Join Date: Apr 2008
Posts: 3
jamesrichie54 is on a distinguished road
it says theres two syntax error and im still so new to obective-c and programming in general i have to ask what is a header file? is it the .m file?
Reply With Quote
  #4  
Old April 28th, 2008, 01:31 PM
Viro's Avatar
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 2,452
Viro will become famous soon enoughViro will become famous soon enough
The header is the .h file.
Reply With Quote
  #5  
Old April 28th, 2008, 07:35 PM
Registered User
 
Join Date: Apr 2008
Posts: 3
jamesrichie54 is on a distinguished road
whats posted above is the header file then
Reply With Quote
  #6  
Old April 29th, 2008, 02:55 AM
Viro's Avatar
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 2,452
Viro will become famous soon enoughViro will become famous soon enough
That could be why you're having problems

The code that you've posted should go into the .m file. Headers contain interface code while .m files contain the implementation details.

Looking at your code, I'm guessing that your header file should contain something like the following

Code:
 
@interface AppController : NSObject {
  IBOutlet id textBox1;
}
- (IBAction)add3:(id)sender;
- (IBAction)subtract3:(id)sender;
@end
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 05:15 PM.


Mac Support® Version 3.7.0 Beta 5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.