title: Another "undefined reference" error when linking boost libraries
body: <p>I've seen several other posts that deal with this exact same issue. However, none of their solutions seem to work for me. I am compiling the following code:
  <code> </p>
  
  <pre>#include &lt;boost/numeric/ublas/matrix.hpp&gt;
  #include &lt;boost/numeric/ublas/io.hpp&gt;
  #include &lt;boost/timer/timer.hpp&gt;
  
  using namespace boost::numeric::ublas;
  
  int main(){    
     matrix&lt;double&gt; mat1 (3,3);
     matrix&lt;double&gt; mat2 (3,3);
     matrix&lt;double&gt; mat3 (3,3);
  
     unsigned k=0;
  
     for(unsigned i = 0; i &lt; mat1.size1(); ++i){
        for(unsigned j = 0; j &lt; mat1.size2(); ++j){
           mat1(i,j) = k;
           mat2(i,j) = 2*k++;
        }   
     }   
  
     k=0;
     if(1){
        boost::timer::auto_cpu_timer t;
        while(k&lt;1000){
           mat3 = prod(mat1,mat2);
           k++;
        }   
     }   
     return 0;
  }
  </code></pre>
  
  <p>I am compiling from the command line using:</p>
  
  <blockquote>
    <p>$ g++ matrix_test.cpp  -o matrix_test -lboost_system -lboost_timer</p>
  </blockquote>
  
  <p>and receiving the following error:</p>
  
  <blockquote>
    <p>usr/lib/gcc/i686-redhat-linux/4.7.0/../../../libboost_timer.so:
    undefined reference to `boost::chrono::steady_clock::now()'<br>
    collect2: error: ld returned 1 exit status</p>
  </blockquote>
  
  <p>If I add -lboost_chrono when I compile, I get this error:</p>
  
  <blockquote>
    <p>/usr/lib/gcc/i686-redhat-linux/4.7.0/../../../libboost_chrono.so:
    undefined reference to `clock_gettime'<br>
    collect2: error: ld returned 1 exit status</p>
  </blockquote>
  
  <p>I can trace clock_gettime to sys/time.h. Unfortunately, I cannot find a corresponding .so file to link to. What am I missing here?</p>