Projects > cpp > Issues > Bug #4363

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

"MainScene::MainScene()", referenced from:

Bug #4363 [Rejected]
dinesh_kachhot 2014-03-12 05:32 . Updated over 2 years ago

I am using cocos2d-x 2.2.2 in xcode 5 .

My problem is when i add new c++ class same as HelloWorldScene.cpp .

But when i run it is giving this error

Apple Mech-o Linker Error
"MainScene::MainScene()", referenced from:

This is my MainScene.h File Code

ifndef SpaceShooterMainScene__

define SpaceShooterMainScene__

include "cocos2d.h"

class MainScene : public cocos2d::CCLayer{
public:
MainScene();
bool init();
static cocos2d::CCScene* scene();

CREATE_FUNC(MainScene);

};

endif /* defined(__SpaceShooter__MainScene__) */

And this is my MainScene.cpp file Code

include "MainScene.h"

USING_NS_CC;

CCScene* MainScene::scene()
{
// 'scene' is an autorelease object
CCScene *scene = CCScene::create();

// 'layer' is an autorelease object
MainScene *layer = MainScene::create();

// add layer as a child to scene
scene->addChild(layer);

// return the scene
return scene;

}

bool MainScene::init(){

return true;

}

Please Help me to get out of here.....

dabingnn 2014-03-12 06:49
  • Status changed from New to Rejected

duplicate with issue #4364

Atom PDF

Status:Rejected
Start date:2014-03-12
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:ios
Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.