I have a common code, more specifically the following:
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Window/Keyboard.hpp>
namespace thread
{
void check_key(sf::Keyboard::Key key)
{
while(true)
{
if(sf::Keyboard::isKeyPressed(key))
{
exit(EXIT_SUCCESS);
}
}
}
}
int main()
{
sf::Thread keycheck(&thread::check_key, sf::Keyboard::Escape);
keycheck.launch();
while(true)
std::cout << "Hello! ";
}
And when I compile in Code :: Blocks, with Wizzard from SFML 2.0, it works correctly (exits when I press ESC). I changed the sf::Thread
to std::thread
and of course: first I activated C ++ 11. Just to see if it was spinning, I tried to compile. MinGW returned several errors of, for example, ::diftime
and other entities only <ctime>
. What should I do?