LuaGlue icon indicating copy to clipboard operation
LuaGlue copied to clipboard

One more compiler problem: template<typename _N, typename T>

Open DominikMS opened this issue 11 years ago • 7 comments

I can't compile your code in Android NDK, why? Look at this:

template<typename _N, typename T>
struct StateBinder
{
};

Throws error:

expected nested-name-specifier before numeric constant  main.cpp line 5 C/C++ Problem
expected '>' before numeric constant    main.cpp line 5 C/C++ Problem

But! This is working well:

template<typename N, typename T>
struct StateBinder
{
};

Difference? _ N changed to N (or to N_), why it happens?

DominikMS avatar Jun 07 '14 15:06 DominikMS

Does the android ndk support C++11? Also I can't imagine why it doesn't support an underscore on template parameter names.... it's a pretty common thing. I'll look into it.

Tomasu avatar Jun 07 '14 16:06 Tomasu

ndk supports c++11. I had to change: _Ret, _Args, _N, _Class, _Type (and std::tuple from previous issue) and sources are compiled fine.

DominikMS avatar Jun 07 '14 16:06 DominikMS

I think that is incredibly strange. what version of gcc does it use? I really don't want to support gcc prior to 4.8. 4.7 and before are buggy and incomplete with C++11. I even got some pretty good internal compiler errors.

Tomasu avatar Jun 07 '14 16:06 Tomasu

I can see there is new update, i will download and check your sources again.

ps. it use 4.8

DominikMS avatar Jun 07 '14 16:06 DominikMS

ndk and cygwin updated, now i have new error code:

'_Class' has not been declared  LuaGlueProperty.h   /LuaGlue    line 211    C/C++ 
'_Type' was not declared in this scope  LuaGlueClass.h /LuaGlue line 305    C/C++ 

DominikMS avatar Jun 07 '14 17:06 DominikMS

Are you sure it isn't because of modifications you've made? I've gotten the examples to compile and run just fine on windows via msys2 and on linux. both gcc 4.8 (4.8.1 for msys2, and 4.8.3 on debian).

Tomasu avatar Jun 07 '14 18:06 Tomasu

Waaaiit, no, _N in LuaGlue is supposed to be an int. not a typename. the way I'm using it it absolutely has to be declared as an int, as using basic types instead of typename or class is treated specially by the compiler when used.

Tomasu avatar Jun 07 '14 18:06 Tomasu