-
Hello. I've been using SFML for a while now and I just upgraded to MinGW GCC 4.7.2. Now, whenever I try to create a window, my program crashes. I'm using SFML 2.0 and I already tried recompiling it and using the already compiled builds posted on the forum.
Creating a window crashes my progam:
int main(int argc, char* argv[])
{
sf::Window window(sf::VideoMode(800, 600, 32), "test"); // crashes
return 0;
}
But other things don't, so as far as I know it's just the window:
int main(int argc, char* argv[])
{
sf::CircleShape circle;
circle.setFillColor(sf::Color::Blue); // won't crash
return 0;
}
Thanks in advance.
-
What does the debugger say?
Are you sure that you recompiled SFML correctly, with the right version of MinGW?
-
I tried recompiling it again. I'm pretty sure I'm using the correct version. This was in the debugger.
(http://i.imgur.com/rLEy1.png)
I also get a segmentation fault.
-
I tried recompiling it again. I'm pretty sure I'm using the correct version. This was in the debugger.
I also get a segmentation fault.
And you're 100% sure you're using the code posted in the first post?
Because the debugger seems to have the height of the window set to 32 and the BitsPerPixel to 2 which then results in a crash, since there's no video mode with 2 bits... ;)
So make sure you've that following code at window creation:
sf::Window window(sf::VideoMode(800, 600), "Hello World");
-
I did actually notice that and I thought it was weird, but I am definitely using the correct code.
#include <iostream>
#include <SFML/Graphics.hpp>
using std::cout;
using std::endl;
int main(int argc, char* argv[])
{
sf::Window window(sf::VideoMode(800, 600), "Hello World");
return 0;
}
-
I did actually notice that and I thought it was weird, but I am definitely using the correct code.
Seriously, I've no idea what's going wrong, but it really seems like your setup is somewhere flawed, since I can build applications fine with MinGW GCC 4.7.2 (see my Nightly Builds (http://en.sfml-dev.org/forums/index.php?topic=9513.msg64716#msg64716) which include examples built with it).
-
Sorry. There must have been something wrong with my MinGW installation, even though I don't know exactly what. I downloaded your compiler and recompiled SFML and everything works now. Thanks.