我收到了一个我不明白的编译时错误列表。我正在使用源码版本0.9.2的luabind库,我试图从MyGUI绑定函数,我正在使用Visual Studio 2012和Lua 5.1。虽然看起来是源于其他文件,但在编译下面的cpp代码时会出现这些错误。这些错误让我觉得我没有在某个地方正确定义签名,但是我的智能感知没有指出任何这样的问题。Luabind编译时错误无法推导出模板参数
有问题的代码:
LuaMachine.cpp(#1抱怨的车身长度,所以我把它放在引擎收录)
给出的错误:
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 &参数。他们应该能够从Lua中获取一个用作充满MyGUI小部件的数组的表格。
我想尝试出口类和函数一次一个,直到你找到它导致错误 – megadan 2014-09-27 01:37:19
鉴于多么乏味,这将是这个相当大的文件,我真的想避免这种情况,但似乎是目前唯一的解决方案。 – 2014-09-27 06:31:17
使用该方法,我能够将问题隔离到wrapGuiManager函数。将继续调查此功能。 – 2014-09-29 21:06:45