Luabind 编译时错误 无法推导模板参数
2014-9-29 21:29:29
收藏:0
阅读:71
评论:1
我遇到了一些我不理解的编译时错误。我正在使用来自sourceforge的luabind库,版本为0.9.1,并且我正在尝试绑定来自MyGUI的函数。我正在使用Visual Studio 2012和Lua 5.1。尽管看起来源自其他文件,但错误会在下面的cpp代码编译期间出现。错误使我认为我在某个地方没有正确定义签名,但是我的IntelliSense没有指出任何这样的问题。
涉及到的代码:
LuaMachine.cpp(Stackoverflow投诉身体太长,所以我把它放在了pastebin上)
给出的错误:
Error 4 error C2780: 'void luabind::detail::value_wrapper_converter<U>::apply(lua_State *,const T &)' : expects 2 arguments - 3 provided c:\users\jake kiesel\space-junk\c++ project\3rdpartycode\include\luabind\detail\call.hpp 293 1 Space Junk
Error 3 error C2784: 'int luabind::detail::value_wrapper_converter<U>::match(lua_State *,luabind::detail::by_const_reference<T>,int)' : could not deduce template argument for 'luabind::detail::by_const_reference<T>' from 'luabind::detail::by_reference<T>' c:\users\jake kiesel\space-junk\c++ project\3rdpartycode\include\boost\preprocessor\iteration\detail\local.hpp 34 1 Space Junk
Error 2 error C2784: 'int luabind::detail::value_wrapper_converter<U>::match(lua_State *,luabind::detail::by_value<T>,int)' : could not deduce template argument for 'luabind::detail::by_value<T>' from 'luabind::detail::by_reference<T>' c:\users\jake kiesel\space-junk\c++ project\3rdpartycode\include\boost\preprocessor\iteration\detail\local.hpp 34 1 Space Junk
Error 6 error C2784: 'T luabind::detail::value_wrapper_converter<U>::apply(lua_State *,luabind::detail::by_const_reference<T>,int)' : could not deduce template argument for 'luabind::detail::by_const_reference<T>' from 'luabind::detail::by_reference<T>' c:\users\jake kiesel\space-junk\c++ project\3rdpartycode\include\luabind\detail\call.hpp 293 1 Space Junk
Error 5 error C2784: 'T luabind::detail::value_wrapper_converter<U>::apply(lua_State *,luabind::detail::by_value<T>,int)' : could not deduce template argument for 'luabind::detail::by_value<T>' from 'luabind::detail::by_reference<T>' c:\users\jake kiesel\space-junk\c++ project\3rdpartycode\include\luabind\detail\call.hpp 293 1 Space Junk
编辑:
通过进一步研究,我发现以下是触发这些错误的问题行。这些行在wrapGuiManager函数中。
luabind::def(“destroyWidgets”,&MyGUIManager :: destroyWidgets)
luabind::def(“unloadLayout”,&MyGUIManager :: unloadLayout),
这些是这些函数的函数声明:
void unloadLayout(luabind :: object&table);
void destroyWidgets(luabind :: object&table);
这两个函数都是独特的,因为它们使用luabind :: object&参数。它们应该能够采取用作包含MyGUI小部件数组的表的Lua表。
点赞
评论区的留言会收到邮件通知哦~
推荐文章
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?
- addEventListener 返回 nil Lua
- Lua中获取用户配置主目录的跨平台方法
我做到了!:D 问题的原因在于以下两行代码:
luabind::def("destroyWidgets", &MyGUIManager::destroyWidgets)和
luabind::def("unloadLayout", &MyGUIManager::unloadLayout)这两个函数都需要使用
luabind::object&,但是 luabind 并不支持这种方式,它需要函数接受luabind::object而不是带引用的luabind::object&。因此,正确的函数声明应该是:void unloadLayout(luabind::object table); void destroyWidgets(luabind::object table);