SFML community forums

Help => Window => Topic started by: Ancient Dragon on September 26, 2010, 04:35:53 pm

Title: Tutorial crashes
Post by: Ancient Dragon 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;
}
Title: Tutorial crashes
Post by: 4ian on September 26, 2010, 06:04:38 pm
Have you linked to the debug libraries ?
Title: Tutorial crashes
Post by: Ancient Dragon on September 26, 2010, 07:39:02 pm
Yes -- see the pragma(comment statement
Title: Tutorial crashes
Post by: OniLinkPlus on September 26, 2010, 10:08:21 pm
Uncomment the pragma for sfml-system-d
Title: Tutorial crashes
Post by: Ancient Dragon 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.
Title: Tutorial crashes
Post by: panithadrum on September 27, 2010, 04:54:21 pm
You have to recompile SFML with Visual Studio 2010