I am trying to compile a code taken from std::this_thread::sleep_for()
#include <iostream>
#include <chrono>
#include <thread>
int main()
{
using namespace std::chrono_literals;
std::cout << "Hello waiter" << std::endl; // flush is intentional
auto start = std::chrono::high_resolution_clock::now();
std::this_thread::sleep_for(2s);
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double, std::milli> elapsed = end-start;
std::cout << "Waited " << elapsed.count() << " ms\n";
}
When I try to compile the code I get the following error
error: 'std::this_thread' has not been declared
My GCC version is 6.3.0.
How can I compile? Any idea?