SFML community forums

Help => Window => Topic started by: ncarrasco on January 30, 2010, 06:10:15 pm

Title: Crash error with Windows Vista / Visual Studio 2008
Post by: ncarrasco on January 30, 2010, 06:10:15 pm
Hi,

I followed all the instructions to setup Visual Studio 2008 and the project to link the static libraries,

the release mode to the release libraries:
sfml-system-s.lib sfml-graphics-s.lib sfml-window-s.lib sfml-audio-s.lib sfml-network-s.lib

debug mode:
sfml-system-s-d.lib sfml-graphics-s-d.lib sfml-window-s-d.lib sfml-audio-s-d.lib sfml-network-s-d.lib

The project complies successfully but it crashes when it runs: saying "Game.exe stopped working".

Any help would be appreciated.

Thanks in advance,
Nicolas.


The code is:
(it also doesn't work with the first example of Window tutorial).

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


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Shapes");

    // Start 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();
        }

        // Clear screen
        App.Clear();

        // Draw predefined shapes
        App.Draw(sf::Shape::Line(10, 10, 710, 100, 15, sf::Color::Red));
        App.Draw(sf::Shape::Circle(200, 200, 100, sf::Color::Yellow, 10, sf::Color::Blue));
        App.Draw(sf::Shape::Rectangle(350, 200, 600, 350, sf::Color::Green));

        // Build a custom convex shape
        sf::Shape Polygon;
        Polygon.AddPoint(0, -50,  sf::Color(255, 0, 0),     sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 0,   sf::Color(255, 85, 85),   sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 50,  sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(0, 100,  sf::Color(255, 255, 255), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 50, sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 0,  sf::Color(255, 85, 85),   sf::Color(0, 128, 128));

        // Define an outline width
        Polygon.SetOutlineWidth(10);

        // Disable filling and enable the outline
        Polygon.EnableFill(false);
        Polygon.EnableOutline(true);

        // We can still use the functions common to all SFML drawable objects
        Polygon.SetColor(sf::Color(255, 255, 255, 200));
        Polygon.Move(300, 300);
        Polygon.Scale(3, 2);
        Polygon.Rotate(45);

        // Draw it
        App.Draw(Polygon);

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

    return EXIT_SUCCESS;
}
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on January 30, 2010, 07:00:31 pm
Compile in debug mode, then run the debugger (F5). It will tell you where exactly the crash happens.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: ncarrasco on January 31, 2010, 05:25:00 pm
Many thanks, Laurent!

The line which is the error is : App.Clear();

I don't have idea of what can be.

Thanks again,
Nicolas.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on January 31, 2010, 07:12:40 pm
What is the error message? Can you show us the callstack?
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: ncarrasco on January 31, 2010, 07:43:19 pm
Hi,

Is says:

Unhandled exception at 0x045e1300 in Game.exe: 0xC0000005: Access violation.

The call stack is:

   045e1300()   
    atioglxx.dll!690d80e2()    
    [Frames below may be incorrect and/or missing, no symbols loaded for atioglxx.dll]   
    atioglxx.dll!6908d2b5()    
    atioglxx.dll!6908d165()    
    atioglxx.dll!6908227c()    
    atioglxx.dll!6907b0ff()    
    atioglxx.dll!6907b055()    
    atioglxx.dll!6907b18f()    
    Game.exe!sf::RenderTarget::Clear()  + 0x17a bytes   
    0024f90c()   
    kernel32.dll!76344911()    
    ntdll.dll!77c8e4b6()    
    ntdll.dll!77c8e489()    

Please let me know if you need more information.

Nicolas.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on January 31, 2010, 08:27:16 pm
Are you in debug mode?
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: ncarrasco on February 01, 2010, 01:32:44 am
Yes.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on February 01, 2010, 08:03:58 am
Are your drivers up-to-date?
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: ncarrasco on February 01, 2010, 11:44:58 pm
Hi Laurent,

I am not very sure I have the latest ATI drivers. Independently of that I found very strange the error, I run a lot of software at my computer without that crashes.

Do you think that it can be a Driver issue?

Thanks in advance,
Nicolas.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on February 01, 2010, 11:50:10 pm
Have you tried to run the precompiled samples from the SFML SDK?
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: ncarrasco on February 02, 2010, 12:11:54 am
Hi,

Now I tried running the precompiled samples and work fine :).
Do you think I should recompile the libraries with my Visual 2008 version?

Thanks in advance!
Nicolas.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on February 02, 2010, 07:39:20 am
Ok, now you can try to recompile those samples and test them again. :)
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: WitchD0ctor on February 08, 2010, 09:02:06 am
Im having the Exact same problems on my laptop that is running Vista, same exact code runs on my XP Desktop fine, was the issue ever found?
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on February 08, 2010, 09:17:59 am
No, I'm still waiting for the results of compiling and testing again the samples.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: panithadrum on February 08, 2010, 10:31:56 am
When something crash with my Visual Studio projects and SFML is because I update from SVN and dont compile the dlls or libs.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: SkyGriffin on February 15, 2010, 10:00:18 pm
In my programme, setting:

#define _HAS_ITERATOR_DEBUGGING 0

gives a crash when calling:

rendertarget::clear(const Color& FillColor = Color(0, 0, 0)).

No idea why. Removing the define seemed to fix the issue.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Laurent on February 16, 2010, 12:02:33 am
Because it makes STL containers have (or not) additional members, and their definition doesn't match the one they had when SFML was compiled. You can see it easily by comparing sizeof(std::vector<int>) when _HAS_ITERATOR_DEBUGGING is defined to 0 and when it is not.

I have no idea why it happens on a call to RenderTarget::Clear though, it doesn't seem to involve any STL container.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: Nexus on February 16, 2010, 01:00:00 am
Quote from: "Laurent"
I have no idea why it happens on a call to RenderTarget::Clear though, it doesn't seem to involve any STL container.
Probably the inconsistent libraries result in undefined behaviour (anywhere in the code), which manifests only at Clear().

Such errors are really evil because they're very hard to find. Some of them have already cost me hours of debugging... ;)
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: ncarrasco on February 17, 2010, 01:23:40 am
Hi,

I had to format my computer and then I installed Windows 7 instead of Vista, I had recompiled the libraries and worked fine, haven't tested if it works with the ones that came originally as now I have Windows 7 it could work without doing a recompilation.

Many thanks and sorry for my delay, I could't chech this before.

Nicolas.
Title: Crash error with Windows Vista / Visual Studio 2008
Post by: WitchD0ctor on February 23, 2010, 02:03:23 am
so it works on Windows 7? thats good because im gonna build a new computer soon with windows 7 64 bit and was wondering if SFML would still work with it, Still stuck working on my game only at school in the mean time :/