02-04-2013, 07:19 AM
I've hit a bit of a roadbump.. GCC does not seem to allow passing a template function as a template function's template argument (template template template)
For example this compiles fine in visual studio, but gives me an error in GCC
For example this compiles fine in visual studio, but gives me an error in GCC
tolua_function(tolua_S, "ForEachPlayer", tolua_YieldTemplate< tolua_ForEach<cWorld, cPlayer, &cWorld::ForEachPlayer> >);
jni/../../source/ManualBindings.cpp: In static member function 'static void ManualBindings::Bind(lua_State*)': jni/../../source/ManualBindings.cpp:1072: error: 'tolua_ForEach<cWorld, cPlayer, &cWorld::ForEachPlayer>' is not a valid template argument for type 'int (*)(lua_State*)' because function 'int tolua_ForEach(lua_State*) [with Ty1 = cWorld, Ty2 = cPlayer, bool (Ty1::* Func1)(cItemCallback<Ty2>&) = &cWorld::ForEachPlayer]' has not external linkage jni/../../source/ManualBindings.cpp:1072: error: 'tolua_ForEach<cWorld, cPlayer, &cWorld::ForEachPlayer>' is not a valid template argument for type 'int (*)(lua_State*)' because function 'int tolua_ForEach(lua_State*) [with Ty1 = cWorld, Ty2 = cPlayer, bool (Ty1::* Func1)(cItemCallback<Ty2>&) = &cWorld::ForEachPlayer]' has not external linkage jni/../../source/ManualBindings.cpp:1072: error: 'tolua_ForEach<cWorld, cPlayer, &cWorld::ForEachPlayer>' is not a valid template argument for type 'int (*)(lua_State*)' because function 'int tolua_ForEach(lua_State*) [with Ty1 = cWorld, Ty2 = cPlayer, bool (Ty1::* Func1)(cItemCallback<Ty2>&) = &cWorld::ForEachPlayer]' has not external linkage jni/../../source/ManualBindings.cpp:1072: error: no matches converting function 'tolua_YieldTemplate' to type 'int (*)(struct lua_State*)' jni/../../source/ManualBindings.cpp:1027: error: candidates are: template<int (* Func1)(lua_State*)> int tolua_YieldTemplate(lua_State*) /cygdrive/d/android-ndk-r8/build/core/build-binary.mk:243: recipe for target `obj/local/armeabi/objs/mcserver/__/__/source/ManualBindings.o' failed make: *** [obj/local/armeabi/objs/mcserver/__/__/source/ManualBindings.o] Error 1