最新的安卓ndk已经不需要cgywin的支持,可以在win32或64环境下直接编译cocos2d-x的源码,
但是其他很多小问题。
1》不要用eclipse直接看.cpp文件,这样的话检测到错误就不可以编译成功, 貌似是应为利用ndk编译没有导入头文件,顾cdt编译时出现错误。
2》设置NDK_MODULE环境变量
导入工程后,开始进行环境配置,点testcpp->project->propertis->c++ build,
修改build command为G:\android\ndk\android-ndk-r9\ndk-build.cmd
然后就是修改android.mk
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := testcpp_sharedLOCAL_MODULE_FILENAME := libtestcppLOCAL_SRC_FILES := testcpp/main.cppLOCAL_C_INCLUDES := $(LOCAL_PATH)/../../ClassesLOCAL_WHOLE_STATIC_LIBRARIES := cocos_testcpp_commonLOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_staticLOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_staticLOCAL_WHOLE_STATIC_LIBRARIES += box2d_staticLOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_staticLOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_staticinclude $(BUILD_SHARED_LIBRARY)$(call import-add-path, G:/cocos2d-x-2.1.5)\$(call import-add-path, G:/cocos2d-x-2.1.5\cocos2dx\platform\third_party\android\prebuilt)\$(call import-module,samples/Cpp/TestCpp)$(call import-module,cocos2dx)$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)$(call import-module,CocosDenshion/android)$(call import-module,extensions)$(call import-module,external/Box2D)$(call import-module,external/chipmunk)
然后开始编译,有问题欢迎留言。
原创