After downloading all the resources in accordance with the tutorial ....
Find the Tools/bindings-generator/test under COCOS2DX project
Found inside there are test.sh, Test.ini, remove the simple suffix after the user.cfg, and Userconf.ini; Change the paths in these four files to those of the resources.
"Test.sh" # Optionsusage () {cat << eofusage: $ [Options]test the C + + <-> JS bindings Generatoroptions:-hthis He Lpdependencies:P Ython_binclang_rootndk_rootdefine this to run from a different directorycxx_generator_rooteof}while Getopts "DVH" OPTION; Docase "$OPTION" ind) debug=1;; v) verbose=1;; h) usageexit 0;; esacdone# exit this script if any commmand failsset-e# find dirdir= "$ (CD" $ (dirname "${bash_source[0]}") "& ;& pwd) "# Read user.cfg if it exists and is readable_cfg_file=$ (dirname" $ ")"/user.cfg "if [-E" $_cfg_file "]then [-R "$_cfg_file"] | | Die "Fatal Error: $_cfg_file exists it is unreadable". "$_cfg_file" fi# pathsif [-Z "${NDK_ROOT+AAA}"]; then#. If Ndk_root is not set, use "$HOME/bin/android-ndk" ndk_root= "/users/tudu/downloads/android-ndk-r9c" Fiif [-Z "${clang_root+aaa}"]; then#. If Clang_root is not set, use "$HOME/bin/clang+llvm-3.1" clang_root= "/users/tudu/downloads/clang+llvm-3.1-x86 _64-apple-darwin11 "Fiif [-Z" ${pytHON_BIN+AAA} "]; then# ... if Python_bin is not set, use "/usr/bin/python2.7" python_bin= "/usr/bin/python2.7" fi# paths with defaults har dcoded to relative pathsif [-Z "${CXX_GENERATOR_ROOT+AAA}"]; Then cxx_generator_root= "$DIR/..." Fiecho "Clang_root: $CLANG _root" echo "Ndk_root: $NDK _root" echo "Cxx_generator_root: $CXX _generator_root" echo "Python_ BIN: $PYTHON _bin "# Generate bindings for simpletest using Android's system Headersecho" generating bindings for SimpleTest With Android headers ... "set-xld_library_path=${clang_root}/lib $PYTHON _bin ${cxx_generator_root}/generator.py ${CXX _generator_root}/test/test.ini-s Testandroid-o./simple_test_bindings
"Test.ini"
<pre name= "code" class= "plain" >[testandroid]name = Simple_testprefix = tttttttclasses = Testbangcocosdir =/Users/ tuyou/downloads/cocos2d-x-2.2.3# from Cocos2dx.ini etc cocos_headers =-i% (cocosdir) s/cocos2dx/include-i% (cocosdir) s/ cocos2dx/platform-i% (Cocosdir) s/cocos2dx/platform/android-i% (cocosdir) s/cocos2dx-i% (cocosdir) s/cocos2dx/ Kazmath/include cocos_flags =-dandroid-dcocos2d_javascriptextra_arguments =% (cocos_headers) s% (cocos_flags) s-d_ Size_t_defined_-nostdinc-nostdinc++-i% (androidndkdir) s/platforms/android-14/arch-arm/usr/include-i% ( Androidndkdir) s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include-i% (androidndkdir) s/sources/cxx-stl/ gnu-libstdc++/4.6/include-i% (Clangllvmdir) s/lib/clang/3.1/include-i% (cxxgeneratordir) s/test/simple_test-x c++# headers =% (cxxgeneratordir) s/test/simple_test/test.hheaders =/users/tuyou/downloads/cocos2d-x-2.2.3/tools/ Bindings-generator/test/simple_test/test.htarget_namespace =remove_prefix =skip = base_objects =abstract_classes =classes_have_type_info = norename =rename_functions =rename_classes =# classes for which there would be no "parent" Lookupclasses_have_no_parents =# base classes which would be skipped when their sub-classes found Them.base_classes_to_ski P =# Determining whether to use Script object (JS object) to control the lifecycle of Native (CPP) object or the other is a Round. Supported values are ' yes ' or ' no '. Script_control_cpp = yes
</pre><p></p><pre>
"User.cfg" python_bin=/usr/bin/python2.7
"Userconf.ini" [default]androidndkdir=/users/tudu/downloads/android-ndk-r9cclangllvmdir=/users/tudu/downloads/ clang+llvm-3.1-x86_64-apple-darwin11cxxgeneratordir=/users/tudu/downloads/cocos2d-x-2.2.3/tools/ Bindings-generator/test
Then execute test.sh
Okay, OK.
The following warning appear to have no effect on the error message printed by the terminal:
/library/python/2.7/site-packages/cheetah-2.4.4-py2.7.egg/cheetah/compiler.py:1509:userwarning:you don ' t has the C version of Namemapper installed! I ' m disabling Cheetah ' s usestackframes option as it is painfully slow with the Python version of Namemapper. You should get a copy of Cheetah with the compiled C version of Namemapper. " \nyou don ' t have the C version of Namemapper installed! "====errors in parsing headers:1. <severity = Warning, location = <sourcelocation file None, line 0, column 0>, details = "argument unused During compilation: '-nostdinc++ ' ">====
Suppose there is severity = error is checked, the previous error can be resolved by altering the above paths
Self-binding issues:
1. Cannot bind the second class of inheritance, when a class inherits more than one class, only the first class that is inherited is bound, because the "js_initclass" function can only accept a parent class in the form of the list. The following is a list of the shapes:
Js_initclass (Jscontext *cx, Jsobject *obj, Jsobject *parent_proto, jsclass *clasp, jsnative constructor, unsigned Nargs, jspropertyspec *ps, Jsfunctionspec *fs, jspropertyspec *static_ps, Jsfunctionspec *static_fs);
COCOS2DX self-binding JS