discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Problem with my first app


From: Philippe C.D. Robert
Subject: Re: Problem with my first app
Date: Sun, 14 Oct 2001 17:05:57 +0200

On Sat, 13 Oct 2001 14:34:48 -0400
PERON Stéphane <speron@telys.com> wrote:

> Ok, ok ... I have made a mistake (amaising that the compilator does not
> say the include file "Fondation.h" does't not exist like it would have done 
> in pure C ..well, I think so :) )
> 
> Well I have corrected the code which is below and I always meet a
> problem at compilation :
> 
> #include <Foundation/Foundation.h>
> #include <AppKit/AppKit.h>

2 minor issues:

- AppKit.h already includes Foundation.h
- ObjC headers should be #imported, not #included

> @interface MyDelegate : NSObject
> - (void) applicationWillFinishLaunching: (NSNotification *)not;
> @end
> 
> @implementation MyDelegate : NSObject

It's 'only'

@implementation MyDelegate

> - (void) applicationWillFinishLaunching: (NSNotification *)not
> {
>   NSMenu *menu;  
>   menu = AUTORELEASE ([NSMenu New]); 

Method names start with a lowercase character:

menu = AUTORELEASE ([NSMenu new]); 

BTW the method 'new' does actually alloc/init using the designated initialiser 
- it is a 'deprecated' method (NeXT wanted to remove it switching from NS 2.x 
to 3.0, but at the end they did not because of legacy stuff ), so it is better 
to use alloc/init directly.

Hope this helps,

-Phil
-- 
Philippe C.D. Robert
Software Engineer
Silicon Graphics, Inc.



reply via email to

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