SFML community forums
Help => Window => Topic started by: lolz123 on September 05, 2010, 04:17:07 pm
-
Hello,
I am new to SFML (just switched over from SDL) and programming in general, so this might be a pretty stupid question, but here it goes:
I tried code from the Window Events as well as the Window Creation tutorials, but while running either of them I get:
Unhandled exception at 0x6903a39d in ThingThingSFML.exe: 0xC0000005: Access violation reading location 0x00000054.
I narrowed down the code to:
#include <SFML/Window.hpp>
int main()
{
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
App.Close();
return EXIT_SUCCESS;
}
yet I still get the same error. It opens a window perfectly, but it gets a memory access violation when Close(); is called. All other examples that do not use the Window class seem to work fine. I was using SFML2.0, so I tried the same with SFML1.6 with no luck (same error)
Compiler: VS2010
I linked to the dynamic versions of the libraries. I tried using sfml-main as well, I can't see how that could possibly make a difference anyways.
What could possibly cause this error?
Thank you for any help you can offer!
-
Remember to link to the debug libraries (with -d suffix) when you compile in debug mode.
-
I did that, I tried it on both debug and release modes. Both give the same error. Like I said, it runs, but it dies on Close();
Debug:
sfml-main-d.lib
sfml-window-d.lib
Release:
sfml-main.lib
sfml-window.lib
All of the DLL's are in the project folder, and I defines the SFML_DYNAMIC macro under Preprocessor.
-
Do you have an ATI graphics card?
-
Yes, I do.
-
Ok, so it's a known bug that I have to fix.
-
I discovered that the access violation actually comes from the window's destructor, not Close(); after attempting to get this to work again after some time.
-
You're using Visual Studio 2010, so you need to recompile SFML from source.
-
I did, I am using SFML2 so I was sort of forced to anyways. I just opened the VC2008 project and VC2010 automatically converted it allowing me to recompile it for 2010 (I generated both both debug and release versions). To make certain I was using the correct .dll's, I checked their "last edited" dates and saw they were the same as the time I recompiled it. Everything else in SFML runs except the windows destructor.