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

Author Topic: SFML 2.0 not immediately compatible with Codeblocks? [SOLVED]  (Read 3791 times)

0 Members and 1 Guest are viewing this topic.

joeben123

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
So I haven't used SFML in quite some time (since 1.6) and I come back to find a new site and a 2.0 release. After downloading 2.0 and configuring codeblocks, I tried running the sample code it provides in the tutorial. This brought up 50 or so errors, which from what I remember means that it wasn't linked properly. I tried a few more times, but to no avail. So I started scrolling through other people's posts and tutorials on getting 2.0 up and running. They are all saying that you have to recompile it with cmake. I was wondering why you have to do this, isn't the download precompiled? And if it does have to be recompiled, could someone point me to a more in depth tutorial, I don't fully understand the one on the site.
« Last Edit: July 03, 2013, 03:06:49 pm by joeben123 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #1 on: July 03, 2013, 07:57:41 am »
You don't need to recompile SFML. If you get compile errors then there are errors in your code. If you get link errors then there are errors in your project settings.
Laurent Gomila - SFML developer

joeben123

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #2 on: July 03, 2013, 08:10:47 am »
Yeah, I was still linking using the global compiler settings like you had to do for 1.6 :P. Now my code compiles without any errors, thanks :) However when I run the code it throws an error saying:

The procedure entry point __gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll.

Here is my code, but I doubt there is anything wrong with it. It's from the tutorial on the main site.

#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;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #3 on: July 03, 2013, 08:59:41 am »
Which SFML 2.0 archive did you download, and what's your version of Code::Blocks?
Laurent Gomila - SFML developer

joeben123

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #4 on: July 03, 2013, 09:16:46 am »
I downloaded the SFML 2.0 archive from the "latest stable build" download page.
http://www.sfml-dev.org/download/sfml/2.0/
GCC 4.7 MinGW (DW2)

I downloaded code::blocks version 12.11 from here:
http://www.codeblocks.org/downloads/26

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #5 on: July 03, 2013, 09:46:24 am »
You must download the TDM SJLJ version, for Code::Blocks 12.11.

This problem occurs almost every week on the forum, but I admit that it's not easy to find the right keywords for finding the corresponding posts.

And it's written in the tutorial

Quote
If you're using the version of MinGW shipped with Code::Blocks, you probably have a SJLJ version.
« Last Edit: July 03, 2013, 09:47:55 am by Laurent »
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11027
    • View Profile
    • development blog
    • Email
AW: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #6 on: July 03, 2013, 09:46:27 am »
You need the TDM version, since C::B ships with that. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #7 on: July 03, 2013, 12:32:24 pm »
This problem occurs almost every week on the forum, but I admit that it's not easy to find the right keywords for finding the corresponding posts.

And it's written in the tutorial

Quote
If you're using the version of MinGW shipped with Code::Blocks, you probably have a SJLJ version.
So... why don't you just get rid of the precompiled DW2 package? Obviously the people who don't bother compiling SFML themselves will have less of an idea about how their exceptions are handled, and the crazy people like me who even care will be able to recompile it for ourselves if we don't like SJLJ. There is a reason SJLJ is the default, it is easier to use for people with less experience.

Never EVER rely on written text to make something clear. Unless someone has to perform at least 20 extra clicks, 100 extra keystrokes and wait at least 5 minutes more, they probably won't notice anything. That is how the internet works. Removing decisions that have to be made removes error sources and will have a direct impact on the number of problems occurring every week on the forum ;).
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #8 on: July 03, 2013, 02:31:21 pm »
Quote
So... why don't you just get rid of the precompiled DW2 package?
Because it is compatible with the official MinGW distribution. Anyone who doesn't use Code::Blocks, or want the latest version of gcc, is likely to download the official MinGW rather than the TDM SJLJ package.

Quote
Never EVER rely on written text to make something clear
At least I can just say "it's written in the tutorial" instead of explaining it again and again. And then people feel dumb instead of complaining about the lack of information.
« Last Edit: July 03, 2013, 02:33:13 pm by Laurent »
Laurent Gomila - SFML developer

joeben123

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #9 on: July 03, 2013, 02:59:37 pm »
:D thanks so much all of you, everything is working perfectly. This saved me even more hours of frustration. I don't remember having to get the TDM SJLJ package with codeblocks, is that new?

Silvah

  • Guest
Re: SFML 2.0 not immediately compatible with Codeblocks?
« Reply #10 on: July 04, 2013, 03:36:05 pm »
Quote
So... why don't you just get rid of the precompiled DW2 package?
Because it is compatible with the official MinGW distribution. Anyone who doesn't use Code::Blocks, or want the latest version of gcc, is likely to download the official MinGW rather than the TDM SJLJ package.
MinGW is lagging behind, the newest GCC version they have is 4.7.2, many people jumped ship to MinGW-w64, which is where most development happens these days.