I think he told you to read the tutorials because your code seems to come out from nowhere. Guessing how to use a library is not the way to go. You first need to learn the basic stuff before trying to go further -- and guess what, all you need to know to correctly get started with SFML is described in the tutorials and the documentation
Now if you still don't want to read that first, here is a list of your mistakes:
- You should have an event loop, and use the sf::Event instance only when pollEvent returned true. Here, all you have is undefined behaviour.
- while(!events) checks the value of the "events" function -- it is always true, it is a non-null address in memory. What you want is to
call the function (with an argument) and then check its return value.
- Although it is not incorrect, your drawing code is weird. You're not supposed to call clear/display several times per frame. But let's say it was just for testing
- You don't need to explicitly close() the window, the destructor takes care of that.