编译是报error: 'EVNET_COME_TO_FOREGROUND' was not declared in this scope

Compile++ thumb  : game_shared <= main.cpp 
jni/hellocpp/main.cpp: In function ‘void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv*, jobject, jint, jint)‘: 
jni/hellocpp/main.cpp:25:10: error: ‘CCDirector‘ has not been declared 
jni/hellocpp/main.cpp:27:9: error: ‘CCEGLView‘ was not declared in this scope 
jni/hellocpp/main.cpp:27:20: error: ‘view‘ was not declared in this scope 
jni/hellocpp/main.cpp:27:27: error: ‘CCEGLView‘ is not a class or namespace 
jni/hellocpp/main.cpp:35:20: error: ‘ccDrawInit‘ was not declared in this scope 
jni/hellocpp/main.cpp:36:34: error: ‘ccGLInvalidateStateCache‘ was not declared in this scope 
jni/hellocpp/main.cpp:38:9: error: ‘CCShaderCache‘ has not been declared 
jni/hellocpp/main.cpp:39:9: error: ‘CCTextureCache‘ has not been declared 
jni/hellocpp/main.cpp:40:9: error: ‘CCNotificationCenter‘ has not been declared 
jni/hellocpp/main.cpp:40:76: error: ‘EVNET_COME_TO_FOREGROUND‘ was not declared in this scope 
jni/hellocpp/main.cpp:41:9: error: ‘CCDirector‘ has not been declared 
/cygdrive/e/android/NDK/android-ndk-r8e-windows-x86/android-ndk-r8e/build/core/build-binary.mk:272: recipe for target `obj/local/armeabi/objs/game_shared/hellocpp/main.o‘ failed 
make: *** [obj/local/armeabi/objs/game_shared/hellocpp/main.o] Error 1 
make: 离开目录“/cygdrive/d/MyCoder/trunk/cocos2d-x/cocos2d-2.1rc0-x-2.1.2-hotfix/cocos2d-2.1rc0-x-2.1.2/testpppp/proj.android” 

编译时,由于在main.cpp中删除了 #include "HelloWorldScene.h",导致没有包含#include "cocos2d.h"而出上述的错误。

则直接在main.cpp中加入#include "cocos2d.h"即可。

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。