これは非常に単純なものでなければならないことはわかっていますが、私の人生ではそれを理解することはできません. XCode に NSWindow を object-c クラスとして認識させることができません。次の簡単なコードがあります。
HelloWorldAppDelegate.h
#import <Cocoa/Cocoa.h>
#import "EAGLView_mac.h"
@interface HelloWorldAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
EAGLView *glView;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet EAGLView *glView;
@end
HelloWorldAppDelegate.m
#import "HelloWorldAppDelegate.h"
#import "EAGLView_mac.h"
@implementation HelloWorldAppDelegate
@synthesize window, glView;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSRect frame = NSMakeRect(0, 0, 480, 320);
window = [[NSWindow alloc] initWithContentRect: frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
//EAGL init code cut for brevity
[window setContent:glView];
[window makeKeyAndOrderFront:self];
}
@end
When I try to compile XCode complains that NSWindow is a receiver type 'void' and not an objective-c class. None of the autocomplete functions popped up when I was typing up the code either. I get an actual error on the call to NSWindow alloc, and a warning on the other two calls to 'window' all complaining that window and/or NSWindow is a receiver type void. It also complains that the methods 'setContent' and 'makeKeyAndOrderFront' are not found? Am I missing an include somewhere?