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

Author Topic: Problem to get started with SFML  (Read 2938 times)

0 Members and 1 Guest are viewing this topic.

Challenger

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Problem to get started with SFML
« on: June 29, 2013, 01:09:16 pm »
Hey guys,

I'm just trying to get started with SFML by using MinGW.
I have SFML 2.0 and MinGW 4.7.2 .
I'm using Code Blocks and I have the dw2 version of MinGW.
So, I've obeyed this tutorial (http://sfml-dev.org/tutorials/2.0/start-cb.php) and thought, I've done well, but when I try to run the example code in the tutorial, I get a "Segmentation fault" error.

Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
In std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::capacity (this=0x6fcc8d40) at d:/programmes/mingw32-4.7/bin/../lib/gcc/mingw32/4.7.2/include/c++/bits/basic_string.h:774 ()

So, why do the code not run?

regards Challenger :)

Zeneus

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Problem to get started with SFML
« Reply #1 on: June 29, 2013, 10:01:27 pm »
Hello!
can you share/message the exact source code/cb project?
I dont think me or someone more experienced can find something to this..
btw: windows/mac/linux???
~Zeneus :)

Challenger

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Problem to get started with SFML
« Reply #2 on: June 30, 2013, 12:00:52 am »
Windows.^^
Code: [Select]
#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;
}

It's an example code from the tutorial I linked. ;)

Zeneus

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: Problem to get started with SFML
« Reply #3 on: June 30, 2013, 02:01:27 pm »
I can't find something else to come up to my mind..
I rarely find segmentation errors..:/
Maybe expl0it3r or Laurent can help out..
PS:: You tried to re-install MinGW?

Challenger

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Problem to get started with SFML
« Reply #4 on: June 30, 2013, 02:55:01 pm »
Yeah, tried to reinstall MinGW.
No success. :(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Problem to get started with SFML
« Reply #5 on: June 30, 2013, 05:31:15 pm »
I'm just trying to get started with SFML by using MinGW.
I have SFML 2.0 and MinGW 4.7.2 .
I'm using Code Blocks and I have the dw2 version of MinGW.
If you're really running MinGW 4.7.2, then I think you'll have to recompile SFML, since the official version support the official MinGW 4.7 branch and the 4.7 TDM versions.

But since it's an error with strings, it might as well be, that you're mixing Debug and Release modes. When you're in debug mode, you'll have to link the debug libraries (with -d suffix) and in release mode the release libraries (without suffix). ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Challenger

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Problem to get started with SFML
« Reply #6 on: June 30, 2013, 08:54:34 pm »
Hm, -d for debug and none for release, exactly what I've done. :(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Problem to get started with SFML
« Reply #7 on: June 30, 2013, 09:01:37 pm »
Hm, -d for debug and none for release, exactly what I've done. :(
Then you have to recompile SFML I guess. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything