Inline enum reflection causes linker error
Posted: 14 Oct 2022, 10:27
Hi!
Could you advice what am I doing wrong?
Here's the header file:
And here's what I get from the linker:
Could you advice what am I doing wrong?
Here's the header file:
Code: Select all
namespace Test
{
enum class TestEnum
{
A = 0,
B = 1
};
}
NS_IMPLEMENT_INLINE_REFLECTION_ENUM(Test::TestEnum)
{
NsVal("A", Test::TestEnum::A);
NsVal("B", Test::TestEnum::B);
}
Enums work without an issue if I separate their declaration and implementation, but I'd like to use NS_IMPLEMENT_INLINE_REFLECTION_ENUM to keep them in one place.error LNK2005: "public: static void __cdecl Noesis::TypeEnumFiller<enum Test::TestEnum>::Fill(class Noesis::TypeEnumCreator<enum Test::TestEnum> &)" (?Fill@[email protected]@Test@@@Noesis@@SAXAEAV?$Ty[email protected]@Test@@@2@@Z) already defined in ***.obj
error LNK2005: "public: static class Noesis::TypeEnum const * __cdecl Noesis::TypeEnumFiller<enum Test::TestEnum>::GetType(void)" (?GetType@[email protected]@Test@@@Noesis@@[email protected]@XZ) already defined in ***.obj