I bought the book "SFML Blueprint" today and in the book the reader was tasked with compiling SFML 2.2 with CMAKE and to compile the basic "make a circle appear" test program. The code compiles but when the application starts it dies with a "X.exe has stopped working. Windows is looking for a solution" dialog popping up.
CMAKE window
and the files it gave me
I followed the steps and compiled SFML and opened C::B, and followed the steps the book said me to follow.
The code example used is from the book and looks like this:
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main(int argc,char* argv[])
{
//the window use for the display
sf::RenderWindow window(sf::VideoMode(400,400),"01_Introduction");
//set the maximum frame per second
window.setFramerateLimit(60);
//construct a circle
sf::CircleShape circle(150);
//set his color
circle.setFillColor(sf::Color::Blue);
//set his position
circle.setPosition(10, 20);
//main loop
while (window.isOpen())
{
//to store the events
sf::Event event;
//process events
while(window.pollEvent(event))
{
//Close window
if (event.type == sf::Event::Closed)
window.close();
//keyboard input : Escape is press
else if (event.type == sf::Event::KeyPressed and event.key.code == sf::Keyboard::Escape)
window.close();
}
//Clear screen
window.clear();
//draw the cirle
window.draw(circle);
//Update the window
window.display();
}
return 0;
}
Anyone has any clue what I might have done wrong? My guess is that I made some error during the CMAKE process, but I have never used CMAKE before so I have no clue what I can try.