VENT_COME_TO_FOREGROUND' was not declared in this scope

在接uc得sdk时,运行demo,导入到Eclipse中编译时出现错误.

百度下有下面的类似问题回答

jni/hellocpp/main.cpp: In function 'void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv*, jobject, jint, jint)':
jni/hellocpp/main.cpp:39:76: error: 'EVENT_COME_TO_FOREGROUND' was not declared in this scope

make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/hellocpp/main.o] Error 1

最后解决方案是找到报错的位置

在这段代码中


 CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
        CCTextureCache::reloadAllTextures();
        CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
        CCDirector::sharedDirector()->setGLDefaultValues(); 


EVENT_COME_TO_FOREGROUND改成EVNET_COME_TO_FOREGROUND
而在cocos2.2.4版本中


则是刚好相反的错误,这时需要把EVNET_COME_TO_FOREGROUND改成EVENT_COME_TO_FOREGROUND

这样就可以解决了,很蛋疼

Last modification:January 1st, 1970 at 08:00 am
如果看了这个文章可以让你少加会班,可以请我喝杯可乐
已打赏名单
微信公众号

Leave a Comment