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

Author Topic: Application compiles and crashes with gui  (Read 5456 times)

0 Members and 3 Guests are viewing this topic.

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« on: July 21, 2009, 10:49:07 pm »
Greetings,

I just wanted to say how much I really like SFML, and I was able to get it up and working on another computer just fine running Windows XP. I installed this on my Vista box using CodeBlocks/MinGW and I am able to compile the application just fine, but when I run the application it immediately locks up and crashes. Whats wierd is that the clock demo works perfectly, so this problem only occurs with a gui.

The code I am using for making a window is:
Code: [Select]

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


int main(int argc, char** argv)
{
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}


So its not anything terribly complicated. Last night at my other machine I got a sprite demo working without any problems, so I am fairly confused as to why this is occuring.

Thanks in advance for the help!

klusark

  • Newbie
  • *
  • Posts: 45
    • View Profile
Application compiles and crashes with gui
« Reply #1 on: July 21, 2009, 11:00:56 pm »
Is that all of your source code? More would be helpful.
You may want to use a RenderWindow instead of a Window.

If you are able to use a debugger, you could step though your program until you find the line that causes it to crash.

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #2 on: July 21, 2009, 11:07:20 pm »
Yes thats all the code I have. I did a test on another computer but unfortunately I don't have that code near me. But thats all the code and I did try a RenderWindow and it failed too. I tried debugging it and as soon as the app even loads it bombs. Not a single line runs.

klusark

  • Newbie
  • *
  • Posts: 45
    • View Profile
Application compiles and crashes with gui
« Reply #3 on: July 21, 2009, 11:12:52 pm »
What is the crash message?
Try adding a event loop.
ex:
Code: [Select]

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


int main(int argc, char** argv)
{
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    bool Running = true;
    while (Running)
    {
        sf::Event Event;
        if (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                Running = false;
        }
        App.Display();
    }

    return EXIT_SUCCESS;
}

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #4 on: July 21, 2009, 11:18:09 pm »
I tried the code and had the same problem.

The crash message is the Vista generic message:
"SFMLTest.exe has stopped working"
"A problem caused the program to stop working correctly.
Windows will close the  program and notify you if a solution is available."

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Application compiles and crashes with gui
« Reply #5 on: July 21, 2009, 11:45:26 pm »
What happens when you don't have any code, at all? Does it crash, too?

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #6 on: July 21, 2009, 11:52:20 pm »
It works fine with just a main function and no SFML references. Prior to doing the graphical gui stuff I was able to compile and execute the clock example from the first tutorial for setting up mingw.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Application compiles and crashes with gui
« Reply #7 on: July 22, 2009, 12:22:30 am »
Well, then your debugger doesn't provide you the correct input. I hope you compile with debugging symbols enabled (-g).

If debugging won't work, you can at least throw some std::cout's in there to see where it actually crashes. This is just too less input to help you out. :)

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #8 on: July 22, 2009, 12:36:50 am »
Good point, you would think with all this education I would remember to insert some cout's. I have no idea why debugging isn't working...

It appears that App.Display() is not working. I updated DX to see if it might be some DirectX library issue but that was up to date with DX9 (I am not sure what version of DX is being used.).

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Application compiles and crashes with gui
« Reply #9 on: July 22, 2009, 12:43:14 am »
Quote from: "Jarek"
(I am not sure what version of DX is being used.).

To be precise: none. SFML uses OpenGL for graphics. :)

What happens when you use an sf::RenderWindow instead of an sf::Window? And does it help when you use Clear() before Display()?

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #10 on: July 22, 2009, 02:57:49 am »
I copied and pasted the code with App.Clear() and I also tried a Window and that didn't work either.

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #11 on: July 22, 2009, 04:27:48 am »
Everyone, thanks for the replies. I really appreciate it. I honestly think this is a problem with Windows Vista. Either it has caused MinGW to work irrationally (I can debug and do everything fine on my XP machine) or there is some rights issue. I tried investigating the rights issue and it doesn't appear to be that, so I am guess it's some sort of side effect with Vista/CodeBlocks/MinGW.

Thanks again!
Go SFML! It rocks!

klusark

  • Newbie
  • *
  • Posts: 45
    • View Profile
Application compiles and crashes with gui
« Reply #12 on: July 22, 2009, 06:02:16 am »
Are you building it on vista? Try a version built on xp in vista. Also try a version built on vista in xp.

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #13 on: July 22, 2009, 04:58:10 pm »
I used the same built library I downloaded on both OS's. I will try to build it tonight.

Jarek

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - s_galland@msn.com
    • View Profile
Application compiles and crashes with gui
« Reply #14 on: July 22, 2009, 07:06:00 pm »
Just wanted to say that I installed SFML on my other Vista machine this morning and it worked fine. It appears it's an isolated issue to that machine. I think it has something to do with MinGW... I am sure that machine is getting jacked up by something else. If it works on this computer I outta be fine :)

Thanks a lot guys!