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

Author Topic: Setting up codeblocks with SFML  (Read 4583 times)

0 Members and 1 Guest are viewing this topic.

ArgentDrake

  • Newbie
  • *
  • Posts: 4
    • View Profile
Setting up codeblocks with SFML
« on: August 09, 2014, 11:10:52 am »
Hello SFML Forum!

I recently wanted to try SFML so I set to work on the tutorial to set up codeblocks with SFML 2.1

I have followed the guide step by step. I can compile, but launching it gave me graphics something .dll is missing. I added the graphics dll to my directory, but now I'm spawning an additional error.

The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library
 ...dir here \sfml-graphics-d-2.dll


So I have no idea what this means. To recap, I dl'd  2.1 GCC 4.7 MinGW (DW2) - 32 bits, and am running the stock code given to test it from the tutorial.

any guidance or help appreciated. Thank you  :)

Strelok

  • Full Member
  • ***
  • Posts: 139
    • View Profile
    • GitHub
Re: Setting up codeblocks with SFML
« Reply #1 on: August 09, 2014, 11:24:34 am »
Incompatible exception handling. download this one sfml for mingw sjlj
Quote
__gxx_personality_v0 is used in the exception handling of the C++ library. MinGW can support a couple different exception models on the x86: sjlj (setjmp/longjmp) or DWARF (DW2). As far as I know, which model will be used is compiled into the compiler - it's not something that can be selected with a command line option.

The sjlj exception model will link to __gxx_personality_sj0, the DW2 exception model links to __gxx_personality_v0.
Quote
There are multiple variants of gcc for Windows, which are incompatible with each other (different exception management, threading model, etc.). Make sure that you pick up the right package according to the version that you use. If you don't know, check which of the libgcc_s_sjlj-1.dll or libgcc_s_dw2-1.dll file you have in your MinGW/bin folder. If you're using the version of MinGW shipped with Code::Blocks, you probably have a SJLJ version.
If you feel like your version of gcc can't work with the precompiled SFML libraries, don't hesitate to recompile SFML, it's not complicated
« Last Edit: August 09, 2014, 11:34:03 am by Strelok »

ArgentDrake

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Setting up codeblocks with SFML
« Reply #2 on: August 09, 2014, 08:58:14 pm »
Thanks for the reply! I could have sworn I tried that version yesterday and got a huge list of errors, but regardless I'm one step forward now.

There is still a problem. Now I can launch my program, but instead of the green circle, I get this.



Any idea what has gone wrong with it?

Thank you :)

Strelok

  • Full Member
  • ***
  • Posts: 139
    • View Profile
    • GitHub
Re: Setting up codeblocks with SFML
« Reply #3 on: August 09, 2014, 09:38:58 pm »
No code, no solution ;)

ArgentDrake

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Setting up codeblocks with SFML
« Reply #4 on: August 09, 2014, 09:42:42 pm »
Sorry, here is the code :P
#include <SFML/Graphics.hpp>

int main()
{
    int x;
    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.draw(shape);
        window.clear();
        window.display();
    }

    return 0;
}
 

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Setting up codeblocks with SFML
« Reply #5 on: August 09, 2014, 09:48:29 pm »
You're clearing after you draw the shape, that's why.

It needs to be:
clear
draw
display

ArgentDrake

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Setting up codeblocks with SFML
« Reply #6 on: August 09, 2014, 09:50:51 pm »
Oh thank you, its working now! I have no idea how the code deviated from the copy paste I did, perhaps an accidental drag n drop. Anyways thank you all for the help!

 

anything