SFML troubles

Started by
2 comments, last by Sixoul 10 years, 6 months ago

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

http://www.gamefromscratch.com/page/Game-from-Scratch-CPP-Edition-Part-2.aspx

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. http://pastebin.com/jDsJr5Em

here's my .h from this tutorial. http://pastebin.com/qgTCVqQ9

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

http://www.sfml-dev.org/tutorials/2.1/start-vc.php

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.

Advertisement

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?

Engineering Manager at Deloitte Australia

Thanks. After adding


Engine::gameWindow

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.

I got it working. I changed it so using sfml would be dynamic and I copied over the dll files to the debug folder.

This topic is closed to new replies.

Advertisement