Error message in question:
LNK2001 unresolved external symbol "public: static class std::vector<struct MakeKey::KeyStruct,class std::allocator<struct MakeKey::KeyStruct> > MakeKey::KeyArray" (?KeyArray@MakeKey@@2V?$vector@UKeyStruct@MakeKey@@V?$allocator@UKeyStruct@MakeKey@@@std@@@std@@A)
Hello i'm kind of new to this whole coding thing and apologize if the error is stupid but I am getting a unresolved external symbol error on both of my public static vectors. I have read through multiple posts on stack overflow and can't seem to figure out what I am doing wrong. Anyway here is the minimal code that produces the same errors. Yes it is important that the vectors remain static because multiple other errors appear if it is non-static.
class MakeKey
{
public:
typedef struct KeyStruct {
sf::Image Img;
sf::Texture Tex;
sf::Sprite Sprite;
}NewKey;
static vector <MakeKey::NewKey> KeyArray;
static vector <sf::RenderWindow*> WindowArray;
static void StepWindows()
{
for (int i{ 0 }; i > MakeKey::KeyArray.size(); i++)
{
WindowArray[i]->clear(sf::Color::Transparent);
WindowArray[i]->draw(KeyArray[i].Sprite);
WindowArray[i]->display();
}
}
};
And my main
int main()
{
MakeKey::StepWindows();
}