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

Author Topic: [SOLVED] Window Crashing  (Read 17643 times)

0 Members and 1 Guest are viewing this topic.

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« on: December 05, 2009, 04:00:06 pm »
Hello, I am trying to run the code on the tutorials about events using a window. I have the linker set up, but it still doesn't work. The most annoying thing is that I can get the System to work, but not Window.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[SOLVED] Window Crashing
« Reply #1 on: December 05, 2009, 04:27:01 pm »
Can you express yourself a little bit more precisely? What doesn't work?

A short example with related error messages wouldn't be bad.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« Reply #2 on: December 05, 2009, 04:38:59 pm »
The program compiles, but when I go to run it, it says "Learning SFML has encountered a problem and needs to close." Here's the code:

Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>

////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
// Create the main window
sf::Window App(sf::VideoMode(800, 600), "SFML Events");

// Start main loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();

                // Escape key : exit
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
// Display window on screen
App.Display();
}

return EXIT_SUCCESS;
}

I know that the error happens when I create a window.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] Window Crashing
« Reply #3 on: December 05, 2009, 05:21:56 pm »
Do you link to the debug libraries in debug mode?
Laurent Gomila - SFML developer

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« Reply #4 on: December 05, 2009, 11:07:21 pm »
Yes.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] Window Crashing
« Reply #5 on: December 05, 2009, 11:38:52 pm »
You should use the debugger to have more informations about the crash.
Laurent Gomila - SFML developer

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« Reply #6 on: December 06, 2009, 12:11:58 am »
I know that it happens when I create the window.

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« Reply #7 on: December 06, 2009, 12:17:12 am »
This is all I can get: Unhandled exception at 0x7c809e32 in SFML Programming.exe: 0xC0000005: Access violation reading location 0x65764520.

I created a new project, but it's the exact same as before.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
[SOLVED] Window Crashing
« Reply #8 on: December 06, 2009, 03:35:01 am »
Are you sure you're linking to sfml*-d.lib in your debug configuration? Maybe upload a minimal example together with project files.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] Window Crashing
« Reply #9 on: December 06, 2009, 11:04:50 am »
You should really learn to use the debugger.

What IDE do you use? Visual Studio? Code::Blocks?
Laurent Gomila - SFML developer

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« Reply #10 on: December 06, 2009, 02:34:06 pm »
I use Visual Studio.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] Window Crashing
« Reply #11 on: December 06, 2009, 02:40:22 pm »
So you just have to run your application using F5 to enable the debugger ;)
Laurent Gomila - SFML developer

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« Reply #12 on: December 07, 2009, 12:37:25 am »
I added #define SFML_DYNAMIC, but it still doesn't work. Is that the correct way to do it?

lotios611

  • Newbie
  • *
  • Posts: 32
    • View Profile
[SOLVED] Window Crashing
« Reply #13 on: December 07, 2009, 01:01:59 am »
Great. Now it says something about a buffer overrun.

TickingHands

  • Newbie
  • *
  • Posts: 6
    • View Profile
[SOLVED] Window Crashing
« Reply #14 on: December 07, 2009, 03:15:52 am »
I had something like that...

Except my problem was that I had both the normal .lib and the -d.lib linked. Make sure that isn't the problem either.

Hope you fix the problem.

 

anything