0

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.

Jake Kiesel
  • 341
  • 4
  • 10
  • 1
    I would try to export classes and functions one at a time until you find which is causing the errors – megadan Sep 27 '14 at 01:37
  • Given how tedious that would be for this rather large file I'd really like to avoid that, but it seems to be the only solution at this point. – Jake Kiesel Sep 27 '14 at 06:31
  • Using that method I was able to isolate the problem down to the wrapGuiManager function. Will continue investigating this function. – Jake Kiesel Sep 29 '14 at 21:06
  • 2
    Could you also post the function declarations for MyGUIManager::destroyWidgets and MyGUIManager::unloadLayout? – megadan Sep 29 '14 at 21:27
  • Done. Thanks for sticking through this with me by the way. – Jake Kiesel Sep 29 '14 at 21:30

1 Answers1

2

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);
greatwolf
  • 20,287
  • 13
  • 71
  • 105
Jake Kiesel
  • 341
  • 4
  • 10