I am trying to create some basic classes and I’m having a lot of trouble even getting them to compile in xcode. Maybe I am missing something, can you help me review this code and see where I’m going wrong.
Power.h
#ifndef __Power__
#define __Power__
#include "cocos2d.h"
class Power : public cocos2d::DrawNode {
public:
CREATE_FUNC(Power);
virtual bool init();
Power();
~Power();
};
#endif
Power.cpp
#include "Power.h"
bool init() {
if(!DrawNode::init()) {
return false;
}
return true;
}
Power::Power() {
CCLOG("power const");
}
Power::~Power() {
CCLOG("power descon");
}
This simple code fails to compile, I get build failures.
Undefined symbols for architecture x86_64:
"Power::Power()", referenced from:
Power::create() in HelloWorldScene.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"Power::Power()", referenced from:
Power::create() in HelloWorldScene.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)