使用 std::string& 的 Luabind 函数不可能引用 pure_out_value 策略吗?
我试图从函数返回一个字符串,但它无法编译。 当我替换 std::string&使用 int& 类型它可以编译,但是我想另外返回布尔值 std::string 我该怎么做?
bool luacw_getElementContent( std::string name, std::string& content, bool fromBeginning )
{
content = "test";
return false;
}
...
luabind::module(myLuaState) [
luabind::def("__getElementContent", &luacw_getElementContent, luabind::pure_out_value(_2))
];
在 lua 中:
success, content = __getElementContent("a", true)
我正在使用 luabind 0.8.1、最新的 Lua、boost 1.4、VC++ 2008
我收到以下编译器错误(似乎无法确定 std::string& 的大小?
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_value<T>)' : could not deduce template argument for 'luabind::detail::by_value<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(71) : see declaration of 'luabind::detail::indirect_sizeof_test'
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(228) : see reference to class template instantiation 'luabind::detail::indirect_sizeof<T>' being compiled
1> with
1> [
1> T=a1
1> ]
1> d:\osxdata\libs\boost\src\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'luabind::detail::pure_out_value_policy<BOOST_PP_ITERATION_0,Policies>::apply<T,Direction>' being compiled
1> with
1> [
1> BOOST_PP_ITERATION_0=2,
1> Policies=luabind::detail::null_type,
1> T=a1 ,
1> Direction=luabind::detail::lua_to_cpp
1> ]
1> d:\osxdata\libs\boost\src\boost\preprocessor\iteration\detail\local.hpp(37) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled
1> with
1> [
1> F=p1,
1> T1=a1,
1> T2=luabind::detail::lua_to_cpp
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\detail\call.hpp(48) : see reference to function template instantiation 'int luabind::detail::invoke_normal<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,Policies>(lua_State *,const F &,Signature,const Policies &,boost::mpl::long_<N>,boost::mpl::false_)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> N=3
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\detail\call.hpp(58) : see reference to function template instantiation 'int luabind::detail::invoke0<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,Policies,boost::is_void<T>>(lua_State *,const F &,Signature,const Policies &,IsVoid,boost::mpl::false_)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>,
1> T=bool,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> IsVoid=boost::is_void<bool>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\make_function.hpp(31) : see reference to function template instantiation 'int luabind::detail::invoke<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,luabind::detail::policy_cons<H,T>>(lua_State *,const F &,Signature,const Policies &)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> H=luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,
1> T=luabind::detail::null_type,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\make_function.hpp(30) : while compiling class template member function 'int luabind::detail::function_invoke<F,Signature,Policies>::operator ()(lua_State *) const'
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\make_function.hpp(76) : see reference to class template instantiation 'luabind::detail::function_invoke<F,Signature,Policies>' being compiled
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\function.hpp(28) : see reference to function template instantiation 'luabind::adl::object luabind::make_function<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,Policies>(lua_State *,F,Signature,Policies)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\function.hpp(27) : while compiling class template member function 'void luabind::detail::function_registration<F,Policies>::register_(lua_State *) const'
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\function.hpp(50) : see reference to class template instantiation 'luabind::detail::function_registration<F,Policies>' being compiled
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\scintillawrapper\mainfrm.cpp(191) : see reference to function template instantiation 'luabind::scope luabind::def<bool(__cdecl *)(std::string,std::string &,bool),luabind::detail::policy_cons<H,T>>(const char *,F,const Policies &)' being compiled
1> with
1> [
1> H=luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,
1> T=luabind::detail::null_type,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_const_pointer<T>)' : could not deduce template argument for 'luabind::detail::by_const_pointer<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(68) : see declaration of 'luabind::detail::indirect_sizeof_test'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_pointer<T>)' : could not deduce template argument for 'luabind::detail::by_pointer<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(65) : see declaration of 'luabind::detail::indirect_sizeof_test'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_const_reference<T>)' : could not deduce template argument for 'luabind::detail::by_const_reference<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(62) : see declaration of 'luabind::detail::indirect_sizeof_test'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2893: Failed to specialize function template 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_reference<T>)'
1> With the following template arguments:
1> 'std::string'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2866: 'luabind::detail::indirect_sizeof<T>::value' : a const static data member of a managed type must be initialized at the point of declaration
1> with
1> [
1> T=a1
1> ]
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(228) : error C2975: 'Size' : invalid template argument for 'luabind::detail::pure_out_value_converter', expected compile-time constant expression
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(163) : see declaration of 'Size'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(211) : warning C4200: nonstandard extension used : zero-sized array in struct/union
1> Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
1> d:\osxdata\libs\boost\src\boost\preprocessor\iteration\detail\local.hpp(37) : see reference to class template instantiation 'luabind::detail::pure_out_value_converter<Size,Policies>' being compiled
1> with
1> [
1> Size=0,
1> Policies=luabind::detail::null_type
1> ]
1>d:\osxdata\libs\boost\src\boost\preprocessor\iteration\detail\local.hpp(37) : warning C4815: 'c1' : zero-sized array in stack object will have no elements (unless the object is an aggregate that has been aggregate initialized)
I'am trying to return a string from a function but it doesn't compile.
When I replace the std::string& type with int& it compiles, however I want to return additionally to the boolean a std::string how do I do this?
bool luacw_getElementContent( std::string name, std::string& content, bool fromBeginning )
{
content = "test";
return false;
}
...
luabind::module(myLuaState) [
luabind::def("__getElementContent", &luacw_getElementContent, luabind::pure_out_value(_2))
];
in lua:
success, content = __getElementContent("a", true)
I'm using luabind 0.8.1, most recent Lua, boost 1.4, VC++ 2008
I get the following compiler error (it seems it can't determine a size for std::string& ?
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_value<T>)' : could not deduce template argument for 'luabind::detail::by_value<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(71) : see declaration of 'luabind::detail::indirect_sizeof_test'
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(228) : see reference to class template instantiation 'luabind::detail::indirect_sizeof<T>' being compiled
1> with
1> [
1> T=a1
1> ]
1> d:\osxdata\libs\boost\src\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'luabind::detail::pure_out_value_policy<BOOST_PP_ITERATION_0,Policies>::apply<T,Direction>' being compiled
1> with
1> [
1> BOOST_PP_ITERATION_0=2,
1> Policies=luabind::detail::null_type,
1> T=a1 ,
1> Direction=luabind::detail::lua_to_cpp
1> ]
1> d:\osxdata\libs\boost\src\boost\preprocessor\iteration\detail\local.hpp(37) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled
1> with
1> [
1> F=p1,
1> T1=a1,
1> T2=luabind::detail::lua_to_cpp
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\detail\call.hpp(48) : see reference to function template instantiation 'int luabind::detail::invoke_normal<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,Policies>(lua_State *,const F &,Signature,const Policies &,boost::mpl::long_<N>,boost::mpl::false_)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> N=3
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\detail\call.hpp(58) : see reference to function template instantiation 'int luabind::detail::invoke0<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,Policies,boost::is_void<T>>(lua_State *,const F &,Signature,const Policies &,IsVoid,boost::mpl::false_)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>,
1> T=bool,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> IsVoid=boost::is_void<bool>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\make_function.hpp(31) : see reference to function template instantiation 'int luabind::detail::invoke<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,luabind::detail::policy_cons<H,T>>(lua_State *,const F &,Signature,const Policies &)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> H=luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,
1> T=luabind::detail::null_type,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\make_function.hpp(30) : while compiling class template member function 'int luabind::detail::function_invoke<F,Signature,Policies>::operator ()(lua_State *) const'
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\make_function.hpp(76) : see reference to class template instantiation 'luabind::detail::function_invoke<F,Signature,Policies>' being compiled
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\function.hpp(28) : see reference to function template instantiation 'luabind::adl::object luabind::make_function<bool(__cdecl *)(std::string,std::string &,bool),boost::mpl::vector4<T0,T1,T2,T3>,Policies>(lua_State *,F,Signature,Policies)' being compiled
1> with
1> [
1> T0=bool,
1> T1=std::string,
1> T2=std::string &,
1> T3=bool,
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Signature=boost::mpl::vector4<bool,std::string,std::string &,bool>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\function.hpp(27) : while compiling class template member function 'void luabind::detail::function_registration<F,Policies>::register_(lua_State *) const'
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\function.hpp(50) : see reference to class template instantiation 'luabind::detail::function_registration<F,Policies>' being compiled
1> with
1> [
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1> d:\osxdata\libs\scintillawrapper\mainfrm.cpp(191) : see reference to function template instantiation 'luabind::scope luabind::def<bool(__cdecl *)(std::string,std::string &,bool),luabind::detail::policy_cons<H,T>>(const char *,F,const Policies &)' being compiled
1> with
1> [
1> H=luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,
1> T=luabind::detail::null_type,
1> F=bool (__cdecl *)(std::string,std::string &,bool),
1> Policies=luabind::detail::policy_cons<luabind::detail::pure_out_value_policy<2,luabind::detail::null_type>,luabind::detail::null_type>
1> ]
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_const_pointer<T>)' : could not deduce template argument for 'luabind::detail::by_const_pointer<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(68) : see declaration of 'luabind::detail::indirect_sizeof_test'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_pointer<T>)' : could not deduce template argument for 'luabind::detail::by_pointer<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(65) : see declaration of 'luabind::detail::indirect_sizeof_test'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2784: 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_const_reference<T>)' : could not deduce template argument for 'luabind::detail::by_const_reference<T>' from 'luabind::detail::by_reference<T>'
1> with
1> [
1> T=std::string
1> ]
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(62) : see declaration of 'luabind::detail::indirect_sizeof_test'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2893: Failed to specialize function template 'luabind::detail::char_array<sizeof(identity<T>::type)> luabind::detail::indirect_sizeof_test(luabind::detail::by_reference<T>)'
1> With the following template arguments:
1> 'std::string'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(78) : error C2866: 'luabind::detail::indirect_sizeof<T>::value' : a const static data member of a managed type must be initialized at the point of declaration
1> with
1> [
1> T=a1
1> ]
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(228) : error C2975: 'Size' : invalid template argument for 'luabind::detail::pure_out_value_converter', expected compile-time constant expression
1> d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(163) : see declaration of 'Size'
1>d:\osxdata\libs\luabind\luabind-0.8.1\luabind\out_value_policy.hpp(211) : warning C4200: nonstandard extension used : zero-sized array in struct/union
1> Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
1> d:\osxdata\libs\boost\src\boost\preprocessor\iteration\detail\local.hpp(37) : see reference to class template instantiation 'luabind::detail::pure_out_value_converter<Size,Policies>' being compiled
1> with
1> [
1> Size=0,
1> Policies=luabind::detail::null_type
1> ]
1>d:\osxdata\libs\boost\src\boost\preprocessor\iteration\detail\local.hpp(37) : warning C4815: 'c1' : zero-sized array in stack object will have no elements (unless the object is an aggregate that has been aggregate initialized)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我逐字复制了您的代码,添加了#includes,为其创建了一个main()和一个lua_State,并且几乎编译了。然后我删除了 luabind::def 行末尾的逗号,然后就编译了。我不知道逗号是否对您来说是错误的,但请尝试下面的内容并让我们知道。
注意:在 Linux 上使用
g++ -c file.cpp
、GCC 4.2.4、Luabind 0.7 和 0.9(预发行版)编译。I copied your code verbatim, added the
#includes
, made amain()
for it and alua_State
, and it almost compiled. Then I just removed the comma at the end of theluabind::def
line, and it compiled. I don't know if the comma is all that was wrong for you, but try what I have below and let us know.Note: compiled with
g++ -c file.cpp
, GCC 4.2.4, Luabind 0.7 and also 0.9 (pre-release), on Linux.修改'pure_out_value(_3)'而不是pure_out_value(_2)?
Instead of pure_out_value(_2), modify 'pure_out_value(_3)'?