我收到了一個我不明白的編譯時錯誤列表。我正在使用源碼版本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