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

Author Topic: Tutorial crashes  (Read 2286 times)

0 Members and 1 Guest are viewing this topic.

Ancient Dragon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Tutorial crashes
« on: September 26, 2010, 04:35:53 pm »
>> sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");

That line crashes when compiled with vc++ 2010 Express in debug mode on  64-bit MS-Windows 7

Quote

Unhandled exception at 0x75a8f7cc in test8.exe: 0xC0000005: Access violation reading location 0x6e695720.


Here is the entire program
Code: [Select]

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>

#pragma comment(lib,"sfml-window-d.lib")
//#pragma comment(lib,"sfml-graphics-d.lib")
//#pragma comment(lib,"sfml-system-d.lib")
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");
 
    // Start the game 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();

        }

        // Set the active window before using OpenGL commands
        // It's useless here because the active window is always the same,
        // but don't forget it if you use multiple windows
        App.SetActive();

        // Clear color and depth buffer

        // Finally, display the rendered frame on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}

4ian

  • Hero Member
  • *****
  • Posts: 680
    • View Profile
    • Game Develop website
Tutorial crashes
« Reply #1 on: September 26, 2010, 06:04:38 pm »
Have you linked to the debug libraries ?

Ancient Dragon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Tutorial crashes
« Reply #2 on: September 26, 2010, 07:39:02 pm »
Yes -- see the pragma(comment statement

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Tutorial crashes
« Reply #3 on: September 26, 2010, 10:08:21 pm »
Uncomment the pragma for sfml-system-d
I use the latest build of SFML2

Ancient Dragon

  • Newbie
  • *
  • Posts: 3
    • View Profile
Tutorial crashes
« Reply #4 on: September 27, 2010, 02:56:25 pm »
Quote from: "OniLink10"
Uncomment the pragma for sfml-system-d


Thanks for the suggestion, but it didn't help.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
Tutorial crashes
« Reply #5 on: September 27, 2010, 04:54:21 pm »
You have to recompile SFML with Visual Studio 2010