title: How to let this_thread::sleep_for(a while)?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4438084/stdthis-threadsleep-for-and-gcc">std::this_thread::sleep_for() and GCC</a>  </p>
  </blockquote>
  
  
  
  <p>Tried to write a simple timer and some code to test it by letting the program sleep for some time:</p>
  
  <pre><code>#include &lt;chrono&gt;
  #include &lt;thread&gt;
  
  Aux::Timer timer;
  timer.start();
  std::this_thread::sleep_for(std::chrono::milliseconds(1000));
  timer.stop();
  std::chrono::duration&lt;int64_t, std::milli&gt; t = timer.elapsed();
  </code></pre>
  
  <p>This gives me a compiler error:</p>
  
  <pre><code>17:45:28 **** Incremental Build of configuration EnsembleClustering-DPar for project EnsembleClustering ****
  make all 
  Building file: ../src/aux/test/AuxGTest.cpp
  Invoking: GCC C++ Compiler
  /usr/local/bin/g++-4.7 -I/usr/local/Cellar/gcc/4.7.2/gcc/include/c++/4.7.2 -I/Users/cls/workspace/gtest/include -I/usr/local/Cellar/log4cxx/0.10.0/include -I/Users/cls/workspace/STINGER/include -O0 -g3 -D_GLIBCXX_DEBUG -p -pg -Wall -c -fmessage-length=0 -std=c++11 -g -pg -fopenmp -MMD -MP -MF"src/aux/test/AuxGTest.d" -MT"src/aux/test/AuxGTest.d" -o "src/aux/test/AuxGTest.o" "../src/aux/test/AuxGTest.cpp"
  ../src/aux/test/AuxGTest.cpp: In member function 'virtual void AuxGTest_testTimer_Test::TestBody()':
  ../src/aux/test/AuxGTest.cpp:72:2: error: 'sleep_for' is not a member of 'std::this_thread'
  make: *** [src/aux/test/AuxGTest.o] Error 1
  </code></pre>
  
  <p>I haven't used the <code>&lt;thread&gt;</code> library before. Can you suggest a quick fix? I'd also be happy with an alternative for testing the correctness of the timer.</p>