GCC, std::thread – type ‘sleep_for’ is not a member of ‘std::this_thread’

If you are trying to use sleep_for() in the standard C++ thread library via GCC and are getting an error like the following:

 

‘sleep_for’ is not a member of ‘std::this_thread’

 

The you may have to define the following symbol:

 
 _GLIBCXX_USE_NANOSLEEP

More information can be found here.