[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: an error from the expression: CLS_ISCLASS((Class)receiver) File: sen
From: |
Fred Kiefer |
Subject: |
Re: an error from the expression: CLS_ISCLASS((Class)receiver) File: sendmsg.c Line 321 |
Date: |
Fri, 13 Feb 2009 08:19:36 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
I don't understand this error message either. But you already should get
some warnings during compilation. sharedApplicatiion is clearly
misspelled and you should get this told by the compiler. Best you fix
you compiler warnings and then report back with a bit more information.
Fred
David T. Shen wrote:
> My platform is Windows XP, and I got a simple GUI program. It compiled
> well, but when I run it, I got an error:
> ---------------------
> Assertion failed!
>
> File: sendmsg.c
> Line: 321
>
> Expression: CLS_ISCLASS((Class)receiver)
>
> --------------------------------------
> here is the code and makefile:
>
> //// AppController.h
> #ifndef _APPController_H_
> #define _APPController_H_
>
> #include <Foundation/NSObject.h>
>
> @class NSWindow;
> @class NSTextField;
> @class NSNotification;
> @class NSMenu;
>
> @interface AppController:NSObject
> {
> NSWindow *window;
> NSTextField *label;
> }
>
> - (void) applicaitonWillFinishLaunching:(NSNotification *)not;
> - (void) applicationDidFinishLaunching: (NSNotification *)not;
>
> @end
>
> #endif
>
>
> -----------------
> ///// AppController.m
> #include "AppController.h"
> #include <AppKit/AppKit.h>
>
> @implementation AppController
>
> -(void) applicationWillFinishLaunching:(NSNotification *)not
> {
> // create menu
> NSMenu *menu;
> NSMenu *info;
>
> menu = [NSMenu new];
> [menu addItemWithTitle: @"Info"
> action:NULL
>
> KeyEquivalent:@""];
> [menu addItemWithTitle: @"Hide"
>
> action:@selector(hide:)
>
> KeyEquivalent:@"h"];
> [menu addItemWithTitle : @"Quit"
>
> action:@selector(terminate:)
>
> KeyEquivalent:@"q"];
>
> info = [NSMenu new];
>
> [info addItemWithTitle : @"Info Panel..."
>
> action:@selector(orderFrontStandardInfoPanel:)
>
> KeyEquivalent:@""];
>
> [info addItemWithTitle : @"Performance"
> action:NULL
>
> KeyEquivalent:@""];
> [info addItemWithTitle : @"Help"
>
> action:@selector(orderFrontHelpPanel:)
>
> KeyEquivalent:@"?"];
>
> [menu setSubmenu: info
> forItem:[menu
> itemWithTitle:@"Info"]];
>
> RELEASE(info);
>
> [NSApp setMainMenu:menu];
> RELEASE(menu);
>
> /**
> * create window
> **/
> window = [[NSWindow alloc] initWithContentRect:
> NSMakeRect(300,300,200,200)
>
>
> styleMask:(NSTitledWindowMask|
>
>
> NSMiniaturizableWindowMask|
>
>
> NSResizableWindowMask)
>
> backing :
> NSBackingStoreBuffered
>
> defer :
> YES];
> [window setTitle:@"Hello window"];
>
> /**
> * Create Lable
> **/
> label = [[NSTextField alloc] initWithFrame: NSMakeRect(30,30,80,30)];
> [label setSelectable: NO];
> [label setBezeled: NO];
> [label seDrawBackground: NO];
> [label setStringValue : "Hello, This is a text field."];
>
> [[window contectView] addSubview: label];
>
> RELEASE(label);
>
> }
>
> -(void) applicationDidFinishLaunching:(NSNotification *)not
> {
> [window makeKeyAndOrderFront : self];
> }
>
> -(void) dealloc
> {
> RELEASE(window);
> [super dealloc];
> }
>
> //
> @end
>
>
>
> ------------------
> //// main.m
> #import <AppController.h>
> #import <AppKit/NSApplication.h>
>
> int main(int argc, const char* argv[] )
> {
> NSAutoreleasePool *pool;
> AppController *delegate;
>
> pool = [[NSAutoreleasePool alloc] init];
> delegate = [[AppController alloc] init];
>
> [NSApplication sharedApplicatiion];
> [NSApp setDelegate: delegate];
>
> RELEASE(pool);
>
> return NSApplicationMain(argc, argv);
> }
>
> -----------------
> //// GNUmakefile
>
> #GNUSTEP_MAKEFILES=/GNUStep/System/Library/Makefiles
> include $(GNUSTEP_MAKEFILES)/common.make
>
> APP_NAME=firstwindow
> firstwindow_HEADERS=AppController.h
> firstwindow_OBJC_FILES=main.m AppController.m
> firstwindow_RESOURCE_FILES=firstwindowInfo.plist
>
> include $(GNUSTEP_MAKEFILES)/application.make
>
>