cocos2d-x项目 ISO C++ forbids declaration of "xxx"with no type [-fpermissive]XX
VS2012 编译运行cocos2d-x项目是可以的,在cygwin64里编译报错,如下
In ^ In file included from jni/../../Classes/AppDelegate.cpp:2:0: jni/../../Classes/GameScene.h:22:7: error: extra qualification 'GameScene::' on member 'menuCloseCallback' [-fpermissive] void GameScene::menuCloseCallback(Object* pSender); ^ /cygdrive/f/yt/application/android-ndk-r9/build/core/build-binary.mk:348: recipe for target 'obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/AppDelegate. o' failed make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/AppDelegate.o] Error 1 make: Leaving directory '/cygdrive/f/yt/game/cocos2d-x-3.0alpha0-pre/projects/te st/proj.android' st/proj.android' |
这是因为 在代码里 vs c++可以识别的代码在linux gcc下编译不识别 ,就找到 GameScene.h 22行处 把 原来的
void GameScene::menuCloseCallback(Object* pSender); 声明 改为 void menuCloseCallback(Object* pSender);就可以顺利的编译通过了