Sign in to follow this  

SFML troubles

Recommended Posts

So I'm just starting out following this tutorial just to get the feel of using SFML.


When I try to run it and I just get an error. I have no idea what the error means.


Error    1    error LNK2001: unresolved external symbol "private: static class sf::RenderWindow Engine::gameWindow" (?gameWindow@Engine@@0VRenderWindow@sf@@A)    c:\Project\Engine.obj    SFMLProj

Error    2    error LNK1120: 1 unresolved externals    c:\Project\Debug\SFMLProj.exe    1    1    SFMLProj


Before I got this error it use to give me break saying line 52 in Engine.cpp was the problem. I don't know why it changed, I did nothing except break and tried running again.


I changed the name of some methods and the class but I'm pretty sure that doesn't matter.


Here's my cpp from this tutorial.

here's my .h from this tutorial.


I used the sfml tutorial to set up the project with static libraries.



Thanks for any help or tips to try to fix this. This has me banging my head before I've even started. Something like this doesn't seem like it's that complicated or should cause a problem.

Edited by Sixoul

Share this post

Link to post
Share on other sites

In your Engine.cpp file:

sf::RenderWindow gameWindow;

Should be something like:

sf::RenderWindow Engine::gameWindow;

Although, what's the point in having a private static renderwindow?

Share this post

Link to post
Share on other sites

Thanks. After adding


it now comes up with


Unhandled exception at 0x77AD2272 (ntdll.dll) in SFMLProj.exe: 0xC0000005: Access violation writing location 0x00000004.


and when I break it goes to the line with the

sf::RenderWindow Engine::gameWindow;

This was actually the original error I had before the unresolved external symbol.

Edited by Sixoul

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this