• Create Account

## SFML crash on startup w/ MinGW

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

### #1NotebookDeviant  Members

182
Like
0Likes
Like

Posted 14 May 2013 - 10:35 AM

So after programming a while in Allegro 4 I finally came to the realization that it's outdated and probably not the best thing to be coding in ; So I installed SFML in CodeBlocks, but now it's acting weird, giving me a: "SFMLtest.exe has stopped working" when I try to pull up any sort of window with it. Any ideas? I'm sure there's an easy fix in this, just everything I've tried so far has failed.

Jack @ That Naughty Panda

"Spooky Scary Mansion" For Wii U Coming Soon!

### #2FLeBlanc  Members

3133
Like
0Likes
Like

Posted 14 May 2013 - 10:44 AM

Post your code. Also, what does a debug stack trace tell you?

### #3NotebookDeviant  Members

182
Like
0Likes
Like

Posted 14 May 2013 - 02:55 PM

Sorry, was at school

#include <iostream>
#include <SFML/graphics.hpp>
#include <SFML/window.hpp>
#include <SFML/system.hpp>

int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);

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

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

return 0;
}



Debug says under function

"sf::Window::Window()    ()

0x003e3104 in ??()

__mingw_CRTStartup()

mainCRTStartup()"

Jack @ That Naughty Panda

"Spooky Scary Mansion" For Wii U Coming Soon!

### #4Crusable  Members

594
Like
0Likes
Like

Posted 14 May 2013 - 04:44 PM

You do not need to include system and window if you include graphics. I tried it out and it works in VS2012. Maybe you installed it wrong.

Edited by Crusable, 14 May 2013 - 04:44 PM.

### #5NotebookDeviant  Members

182
Like
0Likes
Like

Posted 14 May 2013 - 04:55 PM

Didn't realize the include thing, cool

Yeah I'm sure it's installed wrong somehow, but I can't see where I went wrong. I did everything right out of the documentation and double checked it.

Jack @ That Naughty Panda

"Spooky Scary Mansion" For Wii U Coming Soon!

### #6JTippetts  Moderators

12315
Like
3Likes
Like

Posted 14 May 2013 - 05:15 PM

Do a debug build, link to the debug libraries, and see what a (good) backtrace will tell you.

Also, what download package are you using? I haven't used SFML in awhile, and always built it from source, but looking at the download page I see that they officially released 2.0 finally, and they have several different downloads available. Of particular interest for you (using MinGW as you are) are the packages labeled GCC 4.7 TDM (SJLJ) and GCC 4.7 MinGW (DW2). There is a potential trap lurking here that you possibly might not be aware of.

You see, if you are using CodeBlocks, then it is possible that you installed the version of MinGW that comes bundled with the codeblocks installer. This version would be GCC 4.7 TDM, which uses SJLJ (set ump long jump) for exception handling. If this is the case, then be warned that the MinGW (DW2) version of SFML won't work, since it uses Dwarf-2 exception handling. Correspondingly, if you didn't install bundled TDM GCC with CodeBlocks, but instead installed a build from MinGW itself, then you would want to install the MinGW (DW2) version and not the TDM GCC (SJLJ) version since most non-TDM builds of MinGW use DW2.

I can't say if this is your issue or not, but it is a potential pitfall that can be a little harder to sort out if you are not aware of the differences between exception handling mechanisms.

### #7Jebbs  Members

280
Like
0Likes
Like

Posted 15 May 2013 - 12:00 AM

If you are still having issues after going through everything JTippetts mentioned, it might be a good idea to post your problem directly to the SFML forums. They are generally pretty helpful with getting people up and running.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.