I have the following code which have 4 static members in the struct. Why can i not initialize it?
I just want a bunch of predefined vectors i can use -.-
Error i get: LNK2005 "public: static union Vec2f const Vec2f::Up" (?Up@Vec2f@@@2T123@A) already defined
union Vec2f {
struct {
f32 x;
f32 y;
};
struct {
f32 w;
f32 h;
};
f32 elements[2];
inline Vec2f() {
x = y = 0;
}
inline Vec2f(f32 value) {
x = y = value;
}
inline Vec2f(f32 newX, f32 newY) {
x = newX;
y = newY;
}
inline Vec2f(const Vec2f &from) {
x = from.x;
y = from.y;
}
static const Vec2f Up;
static const Vec2f Down;
static const Vec2f Left;
static const Vec2f Right;
};
const Vec2f Vec2f::Up = Vec2f(0, 1);
const Vec2f Vec2f::Down = Vec2f(0, -1);
const Vec2f Vec2f::Left = Vec2f(-1, 0);
const Vec2f Vec2f::Right = Vec2f(1, 0);