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

Author Topic: Crash on startup (2.0 RC) in VideoMode  (Read 4344 times)

0 Members and 2 Guests are viewing this topic.

Vaniax

  • Newbie
  • *
  • Posts: 3
    • View Profile
Crash on startup (2.0 RC) in VideoMode
« on: June 22, 2012, 09:15:08 am »
Hi,

I have a problem when I try to use SFML 2.0 RC with CodeBlocks' newest nightly build and MinGW (GCC 4.7). I installed everything correctly (with the tutorial for the 2.0 version) and I can compile without any errors, but I cannot start the compiled programs. Every program crashes on startup (tried with Windows XP and Windows 7 X64). When I reduce the example program from the tutorial to the following, then I get a segmentation fault in the function VideoMode:

#include <SFML/Graphics.hpp>

int main()
{
    sf::Window App(sf::VideoMode(), "SFML Window");

    return 0;
}

 

Here is my call stack log:

#0 6E182B40   sf::VideoMode::VideoMode(this=0x403064) (D:\developpement\sfml-master\src\SFML\Window\VideoMode.cpp:40)
#1 0040140B   main() (D:\xxx\Programmieren\Projektdateien\Privat\CPP\SFML_Uebung\Quellcode\Test.cpp:6)

Can anybody explain, why that happens? I have no idea what can cause this problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Crash on startup (2.0 RC) in VideoMode
« Reply #1 on: June 22, 2012, 09:27:26 am »
You can try with a valid video mode instead of an empty one, but... the error is most likely caused by a bad version of SFML.

Have a look at the output of "gcc -v", and if it has
threading model: pthread
then it won't be compatible with the precompiled SFML libraries, and you'll have to recompile them.

If the threading model is ok ("win32") then make sure that you chose the right exception model (SJLJ vs DW2).
Laurent Gomila - SFML developer

Vaniax

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Crash on startup (2.0 RC) in VideoMode
« Reply #2 on: June 22, 2012, 12:54:28 pm »
Ok, the threading model is win32. My MinGW version uses the DW2 exception model (so I have the libgcc_s_dw2-1.dll). To be sure, I tried both versions of SFML, but the execution error appears every time.

Do you mean with valid video mode something like this.

sf::Window App(sf::VideoMode(200, 200, 32), "SFML Window");   or

sf::Window App(sf::VideoMode::GetDesktopMode(), "SFML Window");
 

No change with that error still appears.
« Last Edit: June 22, 2012, 01:03:08 pm by Vaniax »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Crash on startup (2.0 RC) in VideoMode
« Reply #3 on: June 22, 2012, 01:08:22 pm »
You should try to recompile SFML.
Laurent Gomila - SFML developer

Vaniax

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Crash on startup (2.0 RC) in VideoMode
« Reply #4 on: June 22, 2012, 01:24:41 pm »
Oh, I hoped I can avoid that, but I think I will give it a try. Should not be too difficult. I will tell you if that works.


EDIT: Ok, I recompiled the shared libraries for debug and release mode and everything works now :D (by the way, the compiled dll's differs a lot in their size compared to the not working ones). Thanks for you help.
« Last Edit: June 22, 2012, 03:40:24 pm by Vaniax »

Silvah

  • Guest
Re: Crash on startup (2.0 RC) in VideoMode
« Reply #5 on: June 22, 2012, 06:00:39 pm »
Have a look at the output of "gcc -v", and if it has
threading model: pthread
then it won't be compatible with the precompiled SFML libraries, and you'll have to recompile them.

If the threading model is ok ("win32") then make sure that you chose the right exception model (SJLJ vs DW2).
And if both the threading model and the exception model are right, there are other parts of the ABI that may not match. Particularly the default calling convention for non-static member functions on Windows, because it changed in GCC 4.7, so there's no way C++ code compiled with 4.7 linked with other C++ code compiled with <= 4.6 is going to work.

In short: if you're using GCC 4.7 (or newer), rebuild everything you use.
« Last Edit: June 22, 2012, 06:02:12 pm by Silvah »