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

Author Topic: SFML window crashes  (Read 6694 times)

0 Members and 1 Guest are viewing this topic.

Themax737

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
SFML window crashes
« on: January 30, 2013, 12:05:33 am »
Hello all,

I'm completely new to libraries and just found out this library. I'm using Code-blocks, I have some C++ basic knowledge.

I tried a first window as shown on the tutorial. When I compile everything compiles nicely, my console starts but no window. Instead I have a message "SFML.exe stopped working"

Any idea what this could be ? Here's my code (very basic) :

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

int main()
{
 // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}


Thank you very much,

Maxime.
« Last Edit: January 30, 2013, 04:25:34 pm by Themax737 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML window crashes
« Reply #1 on: January 30, 2013, 12:16:49 am »
Welcome to SFML then! :)

Btw if you're posting code, you should make use of the code=cpp tag and not use a quote.

Could you try this a bit better example? If you don't process events Windows will flag your application as dead after 5 seconds or so.
 #include <SFML/Graphics.hpp>
 
 int main()
 {
     // Create the main window
     sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

     while (window.isOpen())
     {
         sf::Event event;
         while (window.pollEvent(event))
         {
             if (event.type == sf::Event::Closed)
                 window.close();
         }

         window.clear();
         window.display();
     }
 }

What exact version of SFML are you using, i.e. where did you get it from?
What's your compilers version?
If it's >= 4.7.x then you'll have to recompile SFML or use my Nightly Builds.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SFML window crashes
« Reply #2 on: January 30, 2013, 05:59:31 am »
yes, try with SFML libraries "MinGW TDM GCC 4.7.1 32bit" from eXpl0it3r's nightly builds http://sfml.my-gate.net/nightly/. The ones from the official download might not work with the latest code::blocks mingw bundle.
Blokade: Source

Themax737

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: SFML window crashes
« Reply #3 on: January 30, 2013, 04:25:10 pm »
Hello,

Thank you for your help  ;)

Quote
Btw if you're posting code, you should make use of the code=cpp tag and not use a quote.

OK, just found it and I edited my post, thanks  ;)

I just tried using the libraries you recommend and it compiles and runs nicely now with the code you gave me  :D My code posted in the first topic doesn't work anymore, I suppose it's because I'm now using SFML 2.0 in stead of 1.6 ?

Anyway, I'm going to discover SFML, I'll surely be back with other questions and problems  :P

Have a good day,

Maxime.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML window crashes
« Reply #4 on: January 30, 2013, 04:31:59 pm »
I suppose it's because I'm now using SFML 2.0 in stead of 1.6 ?
Yeah. Didn't even see that your code was SFML 1.6... SFML 2 is better anyways.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything