2014年6月14日 星期六

Cocos2d-x 錯誤訊息記錄

1.
[armeabi] Compile++ thumb: cocos2dcpp_shared <= AppDelegate.cpp
jni/../../Classes/AppDelegate.cpp: In member function 'virtual bool AppDelegate::applicationDidFinishLaunching()':
jni/../../Classes/AppDelegate.cpp:20:44: error: 'ResolutionPolicy' is not a class or namespace
make.exe: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/AppDelegate.o] Error 1

ANS:
The syntax MyEnum::SomethingElse is a Microsoft extension. It happens to be one I like, but it's not Standard C++. enum values are added to the surrounding namespace:
 // header
 enum MyEnum {Something = 0, SomethingElse = 1};

 class MyClass {

 MyEnum enumInstance;
 void Foo();

 }

 // implementation
 #include "MyClass.h"

 void Foo() {
     enumInstance = SomethingElse;
 }
意思是說ResolutionPolicy::kResolutionShowAll 是 Microsoft extension
用 jni 的話就看不懂了...  只要寫 kResolutionShowAll 就好。


2.
C:/Users/Jake/android/develope/android-ndk-r9c/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/HelloWorldScene.o: in function NewScene::create():jni/../../Classes/NewScene.h:45: error: undefined reference to 'vtable for NewScene'

ANS:
新增.cpp 檔案要把檔案加入 android.mk 裡面... 不然會找不到。

3.
Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.

Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.


ANS:
1、找到你的项目
2、点击右键
3、打开Properties属性项
4、选中左边Java Build Path项,并在该选项中打开Libraries选项卡,如上图中,将Android Dependencies项和Android Private Libraries这两项Remove掉。
5、Clean up该项目
6、重新编译运行。

沒有留言:

張貼留言