SFML community forums

Help => Window => Topic started by: chessguy on June 02, 2013, 02:47:56 am

Title: Error on window declaration
Post by: chessguy on June 02, 2013, 02:47:56 am
Greetings. Anyway...yup. Another problem.

If I use a window in a function (local), it works fine. However, when I made a global container, with it as a static member, its declaration (in the cpp), it threw an exception:

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

http://pastebin.com/9gZVpxn2 (http://pastebin.com/9gZVpxn2)

^the two files related to this. Anyway, it throws on the cpp, on the declaration of the window.

Any ideas?
Title: Re: Error on window declaration
Post by: massive_potato on June 02, 2013, 07:08:04 am
I think that I saw somewhere on the forums that declaring a static window is a bad idea, since it interferes with the global variables used internally by SFML. I could be wrong, but you could try redesigning your program to not rely on a static window.
Title: Re: Error on window declaration
Post by: Nexus on June 02, 2013, 09:27:40 am
massive_potato is right. In general, avoid static and global variables unless really necessary. There is almost always a way around them, it just requires some thinking about design ;)