Hello all, I have been using cocos2d for a couple years now, I have finally decide to make the jump to cocos2dx (I am using version 2.1). One thing that is giving me trouble is creating the game play layer than adding a background layer behind, and a foreground layer in front. When I compile I get the following errors:
Undefined symbols for architecture i386:
“vtable for backGroundLayer”, referenced from:
backGroundLayer::backGroundLayer() in gameLogic.o
“vtable for hudLayer”, referenced from:
hudLayer::hudLayer() in gameLogic.o
I would appreciate any help, my code is below:
<code
#include “cocos2d.h”
class backGroundLayer : public cocos2d::CCLayer
{
public:
virtual bool init();
CREATE_FUNC(backGroundLayer);
};
#include “backGroundLayer.h”
bool backGroundLayer::init(){
if (!CCLayer::init() ){
CCLOG(“you should not see this”);
return false;
}
return true;
}
#include “cocos2d.h”
class hudLayer : public cocos2d::CCLayer
{
public:
virtual bool init();
CREATE_FUNC(hudLayer);
};
#include “hudLayer.h”
using namespace cocos2d
bool hudLayer::init(){
if (!CCLayer::init() ){
CCLOG(“you should not see this”);
return false;
}
return true;
}
#include “cocos2d.h”
#include “Box2D.h”
#include “hudLayer.h”
#include “backGroundLayer.h”
class gameLogic : public cocos2d::CCLayer{
public:
virtual bool init();
static cocos2d::CCScene* scene();
CREATE_FUNC(gameLogic);
};
#include “gameLogic.h”
using namespace cocos2d;
CCScene* gameLogic::scene()
{
CCScene *scene = CCScene::create();
gameLogic* layer = gameLogic::create();
hudLayer* Hud = hudLayer::create();
backGroundLayer*back=backGroundLayer::create();
scene->addChild(layer);
scene~~>addChild;
scene~~>addChild(back);
return scene;
}
bool gameLogic::init(){
if (!CCLayer::init() ){
CCLOG (“you should not see this”);
return false;
}
return true;
}
>