一直用的window,最近开始接触Mac。
现在的问题是,Mac下编译代码,会提示未定义符号的错误。而iOS下就没问题。
如:
class smallStone:public Sprite
{
public:
static smallStone * createStone(char * frameName);
};
smallStone* smallStone::createStone(char * frameName)
{
smallStone *sprite = new smallStone();
return sprite;
}
然后再hello world::init 里这样用:
smallStone * stone = smallStone::createStone(“001_a.png”);
就会报错
Undefined symbols for architecture x86_64:
“smallStone::createStone(char*)”, referenced from:
HelloWorld::init() 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)
。
Xcode新手,还请勿喷。