create_func 问题

he4330937
Fri, 03 Jan 2014 08:24:41 +0000

StaticLibrary : libcpufeatures.a
SharedLibrary : libcocos2dcpp.so
D:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/…/lib/gcc/arm-linux-androideabi/4.6/…/…/…/…/arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/cocos2dcpp_shared///Classes/AppDelegate.o: in function MainMenuLayer::create():jni/…/…/Classes/MainMenuLayer.h:19: error: undefined reference to ‘MainMenuLayer::init()’
D:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/…/lib/gcc/arm-linux-androideabi/4.6/…/…/…/…/arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/cocos2dcpp_shared///Classes/AppDelegate.o: in function MainMenuLayer::create():jni/…/…/Classes/MainMenuLayer.h:19: error: undefined reference to ‘vtable for MainMenuLayer’
collect2: ld returned 1 exit status
make: *** Error 1
/cygdrive/d/android-ndk-r9/build/core/build-binary.mk:533: recipe for target obj/local/armeabi/libcocos2dcpp.so' failed make: Leaving directory /cygdrive/d/cocos2d-x/cocos2d-x-2.2.1/cocos2d-x-2.2.1/projects/CPPSecondDemo/proj.android’

出错的是 CREATE_FUNC(MainMenuLayer); 这行

#include “cocos2d.h”

class MainMenuLayer : public cocos2d::CCLayer
{
public:
MainMenuLayer(void);
~MainMenuLayer(void);

// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();

// a selector callback
void menuExitCallback(CCObject* pSender);

void menuStartCallback(CCObject* pSender);

void menuVersionCallback(CCObject* pSender);

CREATE_FUNC(MainMenuLayer);

};

请问如何解决？

阅读整个主题