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

Author Topic: Window Crashes Immediately.  (Read 2130 times)

0 Members and 1 Guest are viewing this topic.

taserman21

  • Newbie
  • *
  • Posts: 6
    • View Profile
Window Crashes Immediately.
« on: November 07, 2015, 09:28:24 pm »
I am trying to learn SFML and tried the first code it shows on the website:
#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(1366, 768), "Hello World!");
        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Blue);

        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;
        }
}
 
After compiling it with g++ -o Hello_World Hello_World.cpp I get:
*** Error in `./Hello_World': free(): invalid pointer: 0x0000000000dfadc8 ***
Aborted (core dumped)
 

Please help me.

GraphicsWhale

  • Full Member
  • ***
  • Posts: 131
    • View Profile
Re: Window Crashes Immediately.
« Reply #1 on: November 07, 2015, 09:36:26 pm »
You're not being very clear. Is the error from the compiler, or is the error from the program?

Also, don't return 0; in the loop. That will close the window (and application).

taserman21

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Window Crashes Immediately.
« Reply #2 on: November 07, 2015, 09:41:44 pm »
You're not being very clear. Is the error from the compiler, or is the error from the program?

Also, don't return 0; in the loop. That will close the window (and application).
It comes from the program and I did try to run it without return 0; and that didn't work either.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Window Crashes Immediately.
« Reply #3 on: November 08, 2015, 12:27:06 am »
It really sounds like you are mixing either debug/release versions or using a copy of SFML that wasn't compiled for the compiler you have. Could you please tell us what compiler version you are using and what SFML package from the website you downloaded?
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor