title: getting started with boost cpu_timer, error: ‘boost::timer::cpu_timer’ has not been declared
body: <p>I'm trying to compile this simple program to start learning how to use timers:</p>
  
  <pre><code>#include &lt;boost/timer.hpp&gt;
  
  using boost::timer::cpu_timer;
  //...
  nanosecond_type last_checkpoint_time = 0;
  cpu_timer checkpoint_timer;  // start the timer
  
  for (;;)
  {
    //process_a_transaction();
    if (checkpoint_timer.elapsed().user - last_checkpoint_time &gt; 5*1000000000LL)
    {
      //... create a checkpoint ...
      last_checkpoint_time = checkpoint_timer.elapsed().user;  
      cout &lt;&lt; checkpoint_timer.elapsed().user &lt;&lt; endl;
    }
  }
  </code></pre>
  
  <p>I'm using gentoo linux and issuing the following command to compile:</p>
  
  <p>g++ -I /usr/include/boost-1_46 timer1.cpp -o timer</p>
  
  <p>I get these errors:</p>
  
  <pre><code>timer1.cpp:3:21: error: ‘boost::timer::cpu_timer’ has not been declared
  timer1.cpp:5:1: error: ‘nanosecond_type’ does not name a type
  timer1.cpp:6:1: error: ‘cpu_timer’ does not name a type
  timer1.cpp:8:1: error: expected unqualified-id before ‘for’
  timer1.cpp:8:8: error: expected unqualified-id before ‘)’ token
  </code></pre>
  
  <p>I was reading the docs under <a href="http://www.boost.org/doc/libs/1_49_0/more/getting_started/unix-variants.html#errors-and-warnings" rel="nofollow">errors and warnings</a> but the problem I am having is that I only have two libraries:</p>
  
  <pre><code>/usr/lib/libboost_test_exec_monitor-1_46.a
  /usr/lib/libboost_test_exec_monitor-mt-1_46.a
  </code></pre>
  
  <p>Is this because I did not use the static-libs flag during compile of boost?  Would I be better off using static-libs?  Maybe this is a tangent.  What else can cause the errors given above?  Please forgive my ignorance as I am pretty new to C++/boost.</p>
  
  <p>Thanks</p>