开发者

Uncaught exception: ReferenceError: 'NSApplication' is undefined

the code shown below gives an exeption

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

@interface Main : NSObject { }
@end
@implementation Main
+(void)main
{
  NSLog(@"Hello world!");
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  NSApplication *anApplication = nil;
  NSArray *screenAr开发者_运维技巧ray = nil;               
  NSEnumerator *screenEnumerator = nil;
  NSScreen *aScreen = nil;
  NSWindowDepth *depths = null;//remove const
  BOOL exactMatch = NO;

  anApplication = [NSApplication sharedApplication];
  screenArray = [NSScreen screens];
  screenEnumerator = [screenArray objectEnumerator];
}
@end

i am using windows and please go through the link below qckapp.com/index.html?p=ObjC


you cannot done it with http://qckapp.com/index.html?p=ObjC

just go through the compiler http://www.gnustep.org


Try

#import <Cocoa/Cocoa.h>

I don't think your imports include the header for NSApplication.

That was wrong. Actually, I think the problem is that you haven't called NSApplicationMain(). It doesn't really make sense to have an application object if you don't have an application (with a user interface). If you don't want a UI, you might get away with using NSApplicationLoad().

Also make sure you are linking the AppKit framework.


your compiler does not have capabilities for ui you just go with http://qckapp.com/index.html?p=ObjC only for basics try gnustep

good luck.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜