Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Error on window declaration  (Read 2273 times)

0 Members and 1 Guest are viewing this topic.

chessguy

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Error on window declaration
« 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

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

Any ideas?

massive_potato

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Error on window declaration
« Reply #1 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Error on window declaration
« Reply #2 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 ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything