discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

an error from the expression: CLS_ISCLASS((Class)receiver) File: sendms


From: David T. Shen
Subject: an error from the expression: CLS_ISCLASS((Class)receiver) File: sendmsg.c Line 321
Date: Thu, 12 Feb 2009 21:52:26 -0800 (PST)

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


-- 
View this message in context: 
http://www.nabble.com/an-error-from-the-expression%3A-CLS_ISCLASS%28%28Class%29receiver%29--File%3A-sendmsg.c-Line-321-tp21990807p21990807.html
Sent from the GNUstep - General mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]