开发者

"Can't find protocol declaration for 'NSApplicationDelegate'" on GNUstep for Windows?

I'm trying to compile some Objective-C code that was written by another programmer on a Mac. I'm using GNUstep for Windows to try and get this code working on my home computer. I really just need his code bits to run, and have little (read: zero) experience with Objective-C. Here is the code:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  AntennaPatternGenAppDelegate.m
//  AntennaPatternGen
//
//

#import "AntennaPatternGenAppDelegate.h"

@implementation AntennaPatternGenAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    // Insert code here to initialize your application 
}

@end
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

and here is the header file:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  AntennaPatternGenAppDelegate.h
//  AntennaPatternGen
//
//

#import <Cocoa/Cocoa.h>

@interface AntennaPatternGenAppDelegate : NSObject <NSApplicationDelegate> {
    NSWindow *window;
}

@property (assign) IBOutlet NSWindow *window;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I am using the following command to try to compile:

gcc -o AntennaPatternGenAppDelegate AntennaPatternGenAppDelegate.m -I /GNUstep/System/Library/Headers \
-L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base

and getting an error saying "cannot find protocol declaration for 'NSApplicationDelegate'", along with several errors that look like syntax errors (stray '@' in program, and some expected identifiers that aren't there)

I've been googling this problem and it seems like the way that protocol declarations happen in Objective C might have changed at some point? People talk about the difference between 10.6 and previous versions of OSX... I'm not sure if this is the same problem I'm facing, or how to make GNUstep work with this older syntax. Again, I have very little idea what I'm talking about, just beginning to get into this programming, so if I've left crucial information out, please let me know.

开发者_如何转开发Thanks for your time!


I also had same problem. But removing this NSApplicationDelegate from @interface AntennaPatternGenAppDelegate : NSObject NSApplicationDelegate { it worked fine(compiled with no errors).


I've never used GNUStep, but it looks like they might have renamed the protocol GSAppDelegateProtocol. You could try changing any references to NSApplicationDelegate to that and see what happens.

EDIT:

On second thought, it looks like it might be an informal protocol, so you could probably just take it out of the header file entirely (along with the pointy brackets, remove those too) and everything should work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜