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

Author Topic: [SOLVED] SFML 2.1 program compiles but fails to run  (Read 1129 times)

0 Members and 1 Guest are viewing this topic.

CodenameD

  • Newbie
  • *
  • Posts: 3
    • View Profile
[SOLVED] SFML 2.1 program compiles but fails to run
« on: August 19, 2014, 11:12:29 am »
I'm using SFML 2.1 (SJLJ) for Windows / GCC (32bit) and am building the project in CodeBlocks 10.05.

I'm trying to run the following code and it crashes. It builds smoothly however.


#include <SFML/Graphics.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;
}

Many may recognize that this is taken directly from the SFML 2.1 tutorial site so I doubt there is anything wrong with the code. I've followed all instructions carefully but I have no clue what's causing it.

Some screenshots showing the build options and the actual error output are provided below:








« Last Edit: August 22, 2014, 04:57:05 pm by CodenameD »

CodenameD

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML 2.1 program compiles but fails to run
« Reply #1 on: August 22, 2014, 08:59:33 am »
BUMP

Can nobody give me any leads about this? This is the official SFML forums right? No one can help?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.1 program compiles but fails to run
« Reply #2 on: August 22, 2014, 09:03:58 am »
Code::Blocks 10.05 is old, the compiler probably doesn't match. You should upgrade Code::Blocks, or recompile SFML with your current compiler.
Laurent Gomila - SFML developer

CodenameD

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SFML 2.1 program compiles but fails to run
« Reply #3 on: August 22, 2014, 04:55:01 pm »
Thanks.  :) Upgrading CodeBlocks to 13.12 did the trick. Program compiles successfully now.