The following code doesn't compile out of the box with g++ 4.4 on Lucid.
---
#include <thread>
int main(int argc, const char* argv[])
{ std::this_thread::sleep_for(std::chrono::seconds(1));
}
---
$ g++ sleep_for.cpp -o sleep_for -std=c++0x
sleep_for.cpp: In function ‘int main(int, const char**)’:
sleep_for.cpp:5: error: ‘sleep_for’ is not a member of ‘std::this_thread’
If compiled with an additional define _GLIBCXX_USE_NANOSLEEP, then it compiles and works fine.
Binary package hint: gcc-4.4
The following code doesn't compile out of the box with g++ 4.4 on Lucid.
---
#include <thread>
int main(int argc, const char* argv[])
std: :this_thread: :sleep_ for(std: :chrono: :seconds( 1));
{
}
---
$ g++ sleep_for.cpp -o sleep_for -std=c++0x
sleep_for.cpp: In function ‘int main(int, const char**)’:
sleep_for.cpp:5: error: ‘sleep_for’ is not a member of ‘std::this_thread’
If compiled with an additional define _GLIBCXX_ USE_NANOSLEEP, then it compiles and works fine.
$ g++ sleep_for.cpp -o sleep_for -std=c++0x -D_GLIBCXX_ USE_NANOSLEEP
The define _GLIBCXX_ USE_NANOSLEEP is set from the gcc configuration scripts and is based on whether nanosleep is supported on the target platform.
This is the case for Ubuntu Lucid, where nanosleep is available.