SFML community forums
Help => General => Topic started by: Airspace on August 12, 2013, 03:40:32 am
-
I have tried to follow the tutorial to get SFML setup under Code::Blocks and when I try to compile and run the program using the code provided in the tutorial windows simply comes up with the executable has stopped working. I have redone the tutorial several times and I have made sure to download the correct version of SFML and it still will not run.
EDIT:
Also I have run the debugger and it keeps telling me that it is a segmentation fault.
-
If it's a segmentation fault, then you're using pointers. Incorrectly, I might add. Please, post complete and minimal source code that demonstrates the issue so we can point out exactly what is wrong.
-
#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;
}
I got the code directly from the tutorial provided on the SFML site.
-
That exact code works perfectly fine on my computer, drawing a green circle that covers the window as expected. Try recompiling SFML or reinstalling it, it may be a bad configuration. Also, make sure you're on the latest version.
-
I actually think that it was that I had not updated my Code::Blocks for quite some time and that it wasn't compatible with the version that I had. After I updated Code::Blocks it all worked fine.
Thank you for all your help.