I'm trying to make my variables in class static. I wrote this code and got several LNK 2001 errors for each variable in class. I have no idea what can promote to this behaviour. Please, help me
Code:
GameObject.h
#pragma once
using namespace std;
using namespace glm;
class GameObject
{
private:
static int id;
static string name;
static string sprite;
static vec2 position;
static vec2 scale;
public:
GameObject(string _name, string _spr, vec2 _pos, vec2 _scale);
void move(vec2 dir);
};
GameObject.cpp
GameObject::GameObject(string _name, string _spr, vec2 _pos, vec2 _scale)
{
name = _name;
sprite = _spr;
position = _pos;
scale = _scale;
}
void GameObject::move(vec2 dir)
{
position += dir;
}