SFML RenderWindow Unhandled Exception

So I've been following an SFML tutorial but unfortunately, it doesn't seem to be working. The tutorial shows a RenderWindow as a global variable and then accesses it like this:

LevelState.h:

struct LevelStateAssets
{
sf::Texture img_background;
sf::Texture img_player;
sf::Texture img_enemy;
};

extern LevelStateAssets ls_Assets;

class LevelState : public StateBase
{
public:
LevelState();
void Input(sf::Event event);
void Update(void);
void Render(void);

private:
sf::Sprite spr_background;
};

LevelState.cpp:

LevelStateAssets ls_Assets;

LevelState::LevelState()
{

spr_background.setTexture(ls_Assets.img_background);
spr_background.setPosition(0, 0);
}
/* More unnecessary code in the middle */

void LevelState::Render(void)
{
window.draw(spr_background);
}


But when I do this, I get an error that says: "Unhandled exception at 0x774F3632 (ntdll.dll) in SFMLTutorial.exe: 0xC0000005: Access violation writing location 0x00000004"

If you could help me that would be great! Thanks for your time! :)

• From just quickly looking over this I wonder where you defined ls_Assets? You declared it in the header but apparently did not define it in the cpp file. – hhofbaue Jul 19 '13 at 8:58
• Sorry, forgot to add that, I did define it (The main post is updated with it now). – Connor W Jul 19 '13 at 16:00
• Is this from a bad youtube tutorial? – Alayric Jul 20 '13 at 15:14