Cocos2d-x C++ build error on Eclipse ADT

人走茶凉 提交于 2019-12-23 04:43:59

问题


I'm newbie of Cocos2d-x C++. I tried to run then debug the sample code HelloCpp of cocos2d-x 2.2.1 on my Mac. The following is what I did:

1 . Set environment variables: NDK_TOOLCHAIN_VERSION, NDK_ROOT, ANDROID_SDK_ROOT, COCOS2DX_ROOT, ...

I can run build_native.sh from Terminal without errors.

2 . Add C++ classes to project

HelloCpp is a C++ project already so I ignored converting this project to C/C++ project in Eclipse.

C++ classes added to project successfully.

3 . Change the project settings to specify how to run make command

In My project -> Properties -> C/C++ Build -> Builder Setting:
   Set "Build command" = /bin/bash ${ProjDirPath}/build_native.sh NDK_DEBUG=1 V=1

In My project -> Properties -> C/C++ Build -> Builder Setting -> Tool Chain Editor:
   Set "Current toolchain" = Android GCC
   Set "Current builder" = Gnu Make Builder

4 . Run project as an Android Application. I got these errors:

.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 68: mkdir: command not found

.../ADT/adt-bundle-mac-x86_64-20130917/android-ndk-r9b//ndk-build: line 40: dirname: command not found

.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 33: dirname: command not found

.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 52: dirname: command not found

.../ADT/adt-bundle-mac-x86_64-20130917/android-ndk-r9b//ndk-build: line 132: uname: command not found

I searched a lot but cannot resolved errors. I was wrong somewhere. Thank you for your help.


回答1:


I've listed all the possibilities to cause error while building cocos2d-x in eclipse here in my blog. Hope it helps you. Let me know if it still doesn't fix your issue.




回答2:


There is a README.md document in 'yourproject/proj.android' folder, it will help you build your project in eclipse.



来源:https://stackoverflow.com/questions/20345192/cocos2d-x-c-build-error-on-eclipse-adt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!