Xcode build error and undeclared method
Xcode build error and undeclared method
- Subject: Xcode build error and undeclared method
- From: Matthew Egan <email@hidden>
- Date: Mon, 6 Mar 2006 13:48:37 +1100
Hello
First off I will clearly state that I'm a newcomer to Cocoa - and
reading my way through O'Reilly - Learning Cocoa with Objective-C
(nearly finished)
And - I apologies for the length of this post - but I'm not really
sure of the problem so I have to give a lot of details about what I'm
doing.
I have a problem with my first project I am trying to do in Xcode and
hopefully someone might be able to point me in the right direction. I
have been over and over the code for several days to see what I am
doing wrong but I can't seem to put my finger on it.
I am trying to make a simple (ha!) app that checks the state of a
software RAID ion a Mac OS X Server and emails if the RAID is broken.
I found a project on Apple's developer site called 'Moriarity' that
pretty much does what I want to do - with a few modifications.
Basically it shows how to implement a Cocoa GUI that wraps command-
line functionality.
http://developer.apple.com/samplecode/Cocoa/
idxInterapplicationCommunication-date.html
I have knocked up a GUI for it and linked it into RAID.m
Then I selected 'Add to Project' and imported TaskWrapper.h and
TaskWrapper.m from the Moriarity project.
Made a few modifications to RAID.h and RAID.m to link into
TaskWrapper.h and TaskWrapper.m
Essentially I have four main files -
RAID.h
RAID.m
TaskWrapper.h
TaskWrapper.m
I have listed the full details of RAID.h and TaskWrapper.h at the end
of this email.
When I build the project it comes up with an error with one of the
methods in RAID.m
- (void)appendOutput:(NSString *)output
error: parse error before ':' token
error: 'appendOutput' undeclared (first used in this function)
OK - now this is is where I need some help ......
appendOutput' is not declared in RAID.h - it's declared in
TaskWrapper.h
And in my RAID.h I have added #import "TaskWrapper.h"
From looking at the code that Apple has given in Moriarity - this is
the same - declared in TaskWrapper.h and not in MoriartyController.h
It appears to me that it's just forgotten all about TaskWrapper.h and
is not even looking at it.
Another curious thing - under Xcode - if I select Project Symbols it
lists all the methods and classes for the whole project.
On my code it has the following :
M appendOutput: Instance TaskWrapper.h:8
M appendOutput: Instance TaskWrapper.h:8
The first line does not appear to link to anything
The second line opens up TaskWrapper.h and highlights the method
On Apple example it's different
M appendOutput: Instance TaskWrapper.h:7
M appendOutput: Instance MoriarityController.m:56
So I would assume I want it to look like this -
M appendOutput: Instance TaskWrapper.h:8
M appendOutput: Instance RAID.m:56
It looks like the links in Apple's code are all working as they
should - just not sure why mine code is not. I'm hoping that someone
might highlight a basic thing that I am missing.
Thanks
Matt Egan
----------------------------
This is RAID.h
#import <Cocoa/Cocoa.h>
#import "TaskWrapper.h"
#import "RAIDstatus.h"
@interface RAID : NSObject <TaskWrapperController>
{
//instance variable declarations
IBOutlet NSNumberFormatter *checkminutes;
IBOutlet id checkRAIDButton2;
IBOutlet NSTextField *Emailaddress;
IBOutlet NSTextField *MailServer;
NSUserDefaults * prefs;
// IBOutlet id findTextField;
// IBOutlet id resultsTextField;
IBOutlet id window;
IBOutlet id relNotesWin;
IBOutlet id relNotesTextField;
TaskWrapper *checkraidTask;
}
//method declarations
- (IBAction)CheckRAID:(id)sender;
- (IBAction)TestEmail:(id)sender;
- (IBAction)textFieldChanged:(id)sender;
- (IBAction)displayReleaseNotes:(id)sender; // powers our addition to
the help menu
@end
--------------------------
This is TaskWrapper.h
#import <Foundation/Foundation.h>
@protocol TaskWrapperController
// Your controller's implementation of this method will be called
when output arrives from the NSTask.
// Output will come from both stdout and stderr, per the TaskWrapper
implementation.
- (void)appendOutput:(NSString *)output;
// This method is a callback which your controller can use to do
other initialization when a process
// is launched.
- (void)processStarted;
// This method is a callback which your controller can use to do
other cleanup when a process
// is halted.
- (void)processFinished;
@end
@interface TaskWrapper : NSObject {
NSTask *task;
id <TaskWrapperController>controller;
NSArray *arguments;
}
// This is the designated initializer - pass in your controller and
any task arguments.
// The first argument should be the path to the executable to launch
with the NSTask.
- (id)initWithController:(id <TaskWrapperController>)controller
arguments:(NSArray *)args;
// This method launches the process, setting up asynchronous feedback
notifications.
- (void) startProcess;
// This method stops the process, stoping asynchronous feedback
notifications.
- (void) stopProcess;
@end
_______________________________________________
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