依照教程把全部资源下载好后.......

找到cocos2dx project下的tools/bindings-generator/test

发现里面有test.sh , test.ini , 去掉simple后缀后的user.cfg  , 与userconf.ini ; 把这四个文件里的路径都改为那些资源的路径

"test.sh"
# options usage(){
cat << EOF
usage: $0 [options] Test the C++ <-> JS bindings generator OPTIONS:
-h this help Dependencies :
PYTHON_BIN
CLANG_ROOT
NDK_ROOT Define this to run from a different directory
CXX_GENERATOR_ROOT EOF
} while getopts "dvh" OPTION; do
case "$OPTION" in
d)
debug=1
;;
v)
verbose=1
;;
h)
usage
exit 0
;;
esac
done # exit this script if any commmand fails
set -e # find current dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # read user.cfg if it exists and is readable _CFG_FILE=$(dirname "$0")"/user.cfg"
if [ -e "$_CFG_FILE" ]
then
[ -r "$_CFG_FILE" ] || die "Fatal Error: $_CFG_FILE exists but is unreadable"
. "$_CFG_FILE"
fi # paths if [ -z "${NDK_ROOT+aaa}" ]; then
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
NDK_ROOT="/Users/tudu/Downloads/android-ndk-r9c"
fi if [ -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"
fi if [ -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 hardcoded to relative paths if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then
CXX_GENERATOR_ROOT="$DIR/.."
fi echo "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 headers
echo "Generating bindings for simpletest with Android headers..."
set -x
LD_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_test
prefix = ttttttt
classes = testbang
cocosdir = /Users/tuyou/Downloads/cocos2d-x-2.2.3 # 从 cocos2dx.ini 等搬过来的
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_JAVASCRIPT extra_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.h
headers = /Users/tuyou/Downloads/cocos2d-x-2.2.3/tools/bindings-generator/test/simple_test/test.h target_namespace =
remove_prefix =
skip =
base_objects =
abstract_classes =
classes_have_type_info = no
rename =
rename_functions =
rename_classes =
# classes for which there will be no "parent" lookup
classes_have_no_parents = # base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = # Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. 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-r9c
clangllvmdir=/Users/tudu/Downloads/clang+llvm-3.1-x86_64-apple-darwin11
cxxgeneratordir=/Users/tudu/Downloads/cocos2d-x-2.2.3/tools/bindings-generator/test

然后执行test.sh

OK了

关于终端打印出的错误提示 , 以下这些warning貌似没影响:

/Library/Python/2.7/site-packages/Cheetah-2.4.4-py2.7.egg/Cheetah/Compiler.py:1509: UserWarning:
You don't have 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++'">
====

假设有severity = error就要检查一番了 , 之前的error一般都能够通过改动上面那些路径而解决

自己主动绑定的问题 :

1 . 不能绑定继承的第二个类 , 一个类继承多个类的时候 , 仅仅有被继承的第一个类被绑定了 ,原因是 "JS_InitClass"这个函数的形參列表中仅仅能接受一个父类.以下是形參列表:

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 自己主动绑定js的更多相关文章

  1. javascript 自己主动绑定JS callback 的方法函数

    自己写的一个javascript 智能绑定callback 而且调用运行的函数.主要用于异步请求的 ajax中: <!DOCTYPE html> <html> <head ...

  2. Cocos2d-x JSB 自己主动绑定bindings

    Javascript Binding (简称JSB) 自己主动绑定教程. Cocos2d-x JSB 自己主动绑定bindings-generator (以下简称B-G) 使用心得 假设想弄清深入原理 ...

  3. cocos2dx的lua绑定

    一.cocos2dx对tolua++绑定的修正 A.c对lua回调函数的引用 在使用cocos2dx编写游戏时,我们经常会设置一些回调函数(时钟.菜单选择等).如果采用脚本方式编写游戏的话,这些回调函 ...

  4. 超链接标签绑定JS事件&&不加"javascript:;"导致的杯具

    很久以来,在写Html和JS时,经常会给超链接<a>标签,绑定JS事件. 我们经常看到这样的写法,<a href="javascript:;" onclick=& ...

  5. 几种自己主动运行js代码的方式

    近期在看jquery,发现他竟然能自己主动运行js代码,于是就查了下.收集了几种经常使用的实现方法 jquery的方法 使用场景:不论什么须要运行的js特效 $(document).ready(fun ...

  6. Cocos2d-x使用Javascript开发js绑定C++&lt;代码演示样例&gt;

    class IOSiAPDelegate{ public: virtual ~IOSiAPDelegate() {} }; class IOSAlipay{ public: IOSAlipay(); ...

  7. way.js - 轻量级、持久化的双向绑定JS库

    AngularJS的双向绑定一直为人称道,但使用AngularJS需要对页面组件化,学习成本还是很高的. 本文源自 https://github.com/gwendall/way.js 边学边译. 使 ...

  8. ASP.Net 在Update Panel局部刷新后 重新绑定JS方法

    我们知道Asp.Net中的Update Panel可以完成页面的局部刷新(实质上是Ajax),但是局部刷新完后,此区域的控件上所绑定的JS方法就会失效,因为我们用如下方法来重新绑定. var prm ...

  9. win7系统cocos2dx 3.4 绑定自定义类到Lua

    Cocos2d-x 3.0开始使用bindings-generator来生成c++类的lua绑定.bindings-generator基于tolua++,通过配置tools/tolua中的ini文件以 ...

随机推荐

  1. HBase、Hive、MapReduce、Hadoop、Spark 开发环境搭建后的一些步骤(export导出jar包方式 或 Ant 方式)

    步骤一 若是,不会HBase开发环境搭建的博文们,见我下面的这篇博客. HBase 开发环境搭建(Eclipse\MyEclipse + Maven) 步骤一里的,需要补充的.如下: 在项目名,右键, ...

  2. 1C课程笔记分享_StudyJams_2017

    课程1C 概述 课程1C是创建一个生日贺卡应用的实践课程,所以本篇笔记分享主要记录个人的实践过程,此外分享一些比较零散的知识点. Drawable文件夹 Drawable文件夹是Android项目统一 ...

  3. Clustered Index Scan 与 Clustered Index Seek

    Clustered Index Scan 与 Clustered Index Seek 在利用 SQL Server 查询分析器的执行计划中,会有许多扫描方式,其中就有 Clustered Index ...

  4. hibernate_07_单表操作_增删改操作

    首先,创建类对象 package com.imooc.hibernate; public class Address { private String postcode; //邮编 private S ...

  5. more-less-cat-tail-head 命令简单分析

    区别:cat一次性把文件内容全部显示出来,管你看不看得清,显示完了cat命令就返回了,不能进行交互式 操作,适合察看内容短小.不超过一屏的文件:more比cat强大一点,支持分页显示,你可以ctrl+ ...

  6. 【sqli-labs】 less35 GET- Bypass Add Slashes(we dont need them) Integer based (GET型绕过addslashes() 函数的整型注入)

    整型注入不用闭合引号,那就更简单了 http://192.168.136.128/sqli-labs-master/Less-35/?id=0 union select 1,database(),3% ...

  7. (转)基于MVC4+EasyUI的Web开发框架经验总结(12)--利用Jquery处理数据交互的几种方式

    http://www.cnblogs.com/wuhuacong/p/4085682.html 在基于MVC4+EasyUI的Web开发框架里面,大量采用了Jquery的方法,对数据进行请求或者提交, ...

  8. dataGridView 设置

    //窗体加载事件 //内容居中 dataGridView1.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCe ...

  9. antd #upload

    import React from 'react' import {Upload, Icon, message,Button } from 'antd' import './index.scss'; ...

  10. DFS-BFS深度优选遍历和广度优先遍历

    https://www.jianshu.com/p/b086986969e6 DFS--需要借助stack实现 stack.push stack.pop BFS--需要借助队列queue stack- ...