【教程分享】cocos2dx3.0rc导出自定义类到lua的方法详细步骤

在按照readMe做了后还是出现了如下的错误提示。跟上面的同学遇到的问题一样。请问有人解决了么

Traceback (most recent call last):
File “/Users/wangping/Desktop/cocos3.1.1Project/MyLuaGame/frameworks/cocos2d-x/tools/bindings-generator/generator.py”, line 1306, in
main()
File “/Users/wangping/Desktop/cocos3.1.1Project/MyLuaGame/frameworks/cocos2d-x/tools/bindings-generator/generator.py”, line 1282, in main
‘headers’: (config.get(s, ‘headers’ , 0, dict(userconfig.items(‘DEFAULT’)))),
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py”, line 623, in get
return self._interpolate(section, option, value, d)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py”, line 691, in _interpolate
self._interpolate_some(option, L, rawval, section, vars, 1)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py”, line 723, in _interpolate_some
option, section, rest, var)
InterpolationMissingOptionError: Bad value substitution:
section:
option : headers
key : cocosdir
rawval : /cocos/cocos2d.h (cocosdir)s/cocos/audio/include/SimpleAudioEngine.h (cocosdir)s/cocos/ui/CCProtectedNode.h

:7: 不错的教程

=。=,今天又尝试了一下 并且查找了一下资源。才发现。。我没有仔细的读readme啊。。。,上面说一定要用ndkr9b…而我用的r9d…真是悲剧。据这个http://www.cocoachina.com/bbs/read.php?tid=195350帖子上说,应该就是这货的问题了

标记一下,备用

这个是需要安python的yaml插件,搜索安装即可

楼主,执行到第六步,如何编译运行呢?

执行 ./genbindings_myclass.py 后出现 下面的错误 好像是没有 c version的cheetah 是什么意思 有知道的吗?

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.

感谢楼主~~~~~~~:14::14::14:

你这个报错是因为.ini文件命名跟里面的命名不同的bug吧

:7:谢谢分享

如果是cocos 3.2的话 platform要改成 -I%(cocosdir)s/cocos/platform -I%(cocosdir)s/cocos/platform/android 不然会报 CCPlatformDefine.h找不到,这个卡了我很久。。。。。:5:

把ini里面的4.7改成4.8

楼主 tolua/README.mdown里的On MAC:


    export NDK_ROOT=/path/to/android-ndk-r9b
    ./genbindings.py
(这个要怎么添加呀  )

self)

File “E:\cocos2d-x-3.2\tools\bindings-generator\clang\cindex.py”, line 2221, i
n from_source
raise TranslationUnitLoadError(“Error parsing translation unit.”)
TranslationUnitLoadError: Error parsing translation unit.

Generating lua bindings fails.

楼主,请问这是为何?

我跟你的问题一样啊!你解决了没有啊! :3:

狠好狠强大

我之前跟你出现的问题一样。
出错的原因应该是ini中的头文件路径有问题。你可以直接写个绝对路径下去试试。

mark mark 不错~~~~

请问,lua function 怎么当参数 传给 C++的 std::function<void()>

缺少各种python 库