开发者

Warning: cWorld "may not respond to '+alloc'

I am just starting out with Objective-C but have done a bunch of C++. Its haunting me because I keep messing up my Objective-C syntax.

I am getting a crash creating my first Objective-C object. I think it may be related to this warning on the alloc function.

cWorld may not respond to '+alloc'

I've seen lots of fixes for '-alloc' but nothing for +alloc. Anyone have any idea what might be causing it?

The crash is in asm code, I don't get much info. The warning is on the line in worldContext.mm seen below... //* WARNING IS HERE

开发者_StackOverflow

This is a snippet from worldContext.mm and all of world.mm + world.h

worldContext.mm

#import "worldContext.h"
#import "scenemanager.h"
#import "matrix4.h"
#import "world.h"

@implementation cWorldContext

- (void)Initialize {

    mSceneManager = new cSceneManager();


    mWorldObj =[[cWorld alloc] init];    //***** WARNING IS HERE
    [mWorldObj Initialize: mSceneManager];
}

World.h

#ifndef __WORLD
#define __WORLD

class cModelBase;
class cSceneManager;

@interface cWorld {

    cSceneManager* mSceneManager;
    cModelBase* mWorldModel;
}

- (void)Initialize: (cSceneManager*) sceneManager;
- (void)Update;
- (void)Shutdown;

@end

#endif

World.mm

#import "world.h"

@implementation cWorld


- (void)Initialize: (cSceneManager*) sceneManager {

    mSceneManager = sceneManager;
}

- (void)Shutdown {

}

- (void)Update {

}

@end


@interface cWorld {

Should be

@interface cWorld : NSObject {
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜