c++visual-studio-2012lualuabind

Luabind compile time error Unable to deduce template argument


I'm getting a list of compile time errors that I don't understand. I'm using the luabind library from sourceforge, version 0.9.1, and I'm trying to bind functions from MyGUI, I'm using Visual Studio 2012, and Lua 5.1. The errors come up during the compilation of the cpp code below, despite seeming to originate in other files. The errors make me think I didn't define a signature correctly somewhere, however my IntelliSense isn't indicating any such problem.

The code in question:

LuaMachine.cpp (Stackoverflow complained about body length, so I put it on pastebin)

The errors given:

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

EDIT:

Through further research I have discovered the following are problem lines that are triggering these errors. These lines are in the wrapGuiManager function.

luabind::def("destroyWidgets", &MyGUIManager::destroyWidgets)

luabind::def("unloadLayout", &MyGUIManager::unloadLayout),

These are the function declarations for those functions:

void unloadLayout(luabind::object& table);

void destroyWidgets(luabind::object& table);

Both of these functions are unique in that they take a luabind::object& parameter. They're supposed to be able to take a table from Lua that is used as an array full of MyGUI widgets.


Solution

  • I got it to work! :D the problem lines were

    luabind::def("destroyWidgets", &MyGUIManager::destroyWidgets)
    

    and

    luabind::def("unloadLayout", &MyGUIManager::unloadLayout)
    

    Both of those functions took luabind::object&, luabind didn't want to cooperate with those though, it instead wanted the functions to take luabind::object without a reference, and just the object itself. So the correct function declarations would be:

    void unloadLayout(luabind::object table);
    void destroyWidgets(luabind::object table);