This code makes the program freeze (“Game.exe has stopped working”):
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
int main()
{
sf::Clock clock;
clock.getElapsedTime();
return 0;
}
However, this doesn’t crash:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
int main()
{
sf::Clock clock;
return 0;
}
I’m using SFML 2.0, Windows 7, MinGW 4.70 (Code::Blocks). I don’t know why, I followed all instructions to link the libraries and nothing seems to be working.
I might be missing something simple through my anger (I’ve been trying to run sample code for a week, nothing has been working), so can anybody throw me a bone?
Other details:
- Linking to the -d libraries didn’t help
- I have all .dll’s in the same directory as the .exe
- Debug and Release mode don’t help
- I have the application set to “GUI Application,” and “Console Application” doesn’t work either
GDB Spits out a seg. fault:
Program received signal SIGSEGV, Segmentation fault.
In sf::Clock::Clock() () (C:\Users\kworden\Documents\Work\Programming\Game\bin\Debug\sfml-system-2.dll)
At C:\Users\kworden\Documents\Work\Programming\Game\main.cpp:8
SOLUTION:
Compile the libraries yourself. I used the tutorial here and relinked to the libs generated by CMake.
Copying the answer from the comment:
I googled this just to see what this lib was an all indications are that you need to recompile the lib: en.sfml-dev.org/forums/index.php?topic=8726.0
This did fix the issue.