SFML community forums

Help => Window => Topic started by: jerryd on October 27, 2016, 06:11:51 am

Title: Window won't stay open
Post by: jerryd on October 27, 2016, 06:11:51 am
SFML forum,
 Windows 7,  CodeLite 9.2.5, TDM-GCC-64,  SFML-2.3.1

 As soon as a window opens my program exits with the message:
 "SFML-Demo has stopped working"

 No error messages from the compiler.
 Here's the code:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My Window");
   
    while (window.isOpen())
    {
        sf::Event event;
       
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }
       
        window.display();
    }
}

 Any suggestions?

Jerry D.
Title: Re: Window won't stay open
Post by: dabbertorres on October 27, 2016, 06:49:53 am
What is the version number for your gcc?

Using pre-built SFML libraries (if so, which?), or compiled yourself?
Title: Re: Window won't stay open
Post by: jerryd on October 27, 2016, 07:45:21 am
dabbertorres,
 Thanks for the reply.

 Don's see a version for the compiler. The folder size is 348MB.

 I just downloaded pre-built SFML files.

Jerry D.
Title: AW: Window won't stay open
Post by: eXpl0it3r on October 27, 2016, 09:02:34 am
Open a command line and run gcc -v inside the compiler's bin directory.
Which package did you download?
Title: Re: Window won't stay open
Post by: jerryd on October 27, 2016, 05:54:42 pm
eXpl0it3r,

 Ran your suggested command and it yielded "gcc version 5.1.0 (tdm64-1)"

Thanks,
Jerry D.
Title: AW: Window won't stay open
Post by: eXpl0it3r on October 27, 2016, 06:31:23 pm
We never provided builds for GCC 5.1, as stated on the download page: The compiler versions have to match 100%!

Either you pick a compiler linked on the download page or you build SFML yourself.

Also make sure that you copy the needed DLLs as stated in the official tutorials.
Title: Re: Window won't stay open
Post by: jerryd on October 27, 2016, 06:44:52 pm

 Pretty sure I copied all the correct .dll files to the Debug folder.
 The only difference is the tutorial suggested the libgcc_S_sjlj-1.dll
 with an upper case 'S"  but the actual one in the bin folder had a
 lower case 's' libgcc_s_sjlj-1.dll.

 How do I get the compiler versions to match?

 I don't really know how the compiler and the SFML relate to each other.

Jerry D.
Title: Re: Window won't stay open
Post by: eXpl0it3r on October 27, 2016, 07:35:29 pm
How do I get the compiler versions to match?
Either you pick a compiler linked on the download page or you build SFML yourself.
Title: Re: Window won't stay open
Post by: jerryd on October 27, 2016, 08:54:29 pm

 OK I'll reinstall everything.

 There are 2 choices at sfml-dev.org
 GCC 4.9.2 TDM(SJLJ) - 64-bit
 GCC 6.1.0 MinGW(SEH) - 64-bit

 Would either work or would you recommend a specific one?


Title: Re: Window won't stay open
Post by: eXpl0it3r on October 27, 2016, 09:16:09 pm
I personally would go with GCC 6.1.0.