我是Cocos2d-x C ++的新手。我试着运行然后在我的Mac上调试cocos2d-x 2.2.1的示例代码HelloCpp。以下是我的所作所为:
1。设置环境变量:NDK_TOOLCHAIN_VERSION,NDK_ROOT,ANDROID_SDK_ROOT,COCOS2DX_ROOT,......
我可以从终端运行build_native.sh而不会出错。
2。将C ++类添加到项目
HelloCpp已经是一个C ++项目了,所以我忽略了将这个项目转换为Eclipse中的C / C ++项目。
C ++类已成功添加到项目中。
3。更改项目设置以指定如何运行make命令
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。将项目作为Android应用程序运行。我收到了这些错误:
.../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
我搜索了很多但无法解决错误。我某处错了。谢谢你的帮助。
答案 0 :(得分:2)
我列出了在eclipse here in my blog中构建cocos2d-x时导致错误的所有可能性。希望它能帮到你。如果它仍然无法解决您的问题,请告诉我。
答案 1 :(得分:0)
'yourproject / proj.android'文件夹中有一个README.md
文档,它将帮助您在eclipse中构建项目。