title: undefined reference to cblas_sgemm
body: <p>I have the following make file</p>
  
  <pre><code>g++ -Wall -O3 -g -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 Matrix.cc -L /usr/lib64/libcblas.so.0 util.cc word_io.cc net_lbl_2reps_scalable.cc train_lbl_2r_ptb.cc -o train_lbl_2r_ptb
  </code></pre>
  
  <p>However I get the error </p>
  
  <blockquote>
    <p>/tmp/cc9NLGFL.o: In function <code>Matrix::scaleAddAB(Matrix const&amp;, Matrix const&amp;, float, float)':
    /home/ncelm/Matrix.cc:316: undefined reference to</code>cblas_sgemm'
    /tmp/cc9NLGFL.o: In function <code>Matrix::scaleAddAtransB(Matrix const&amp;, Matrix const&amp;, float, float)':
    /home/ncelm/Matrix.cc:330: undefined reference to</code>cblas_sgemm'
    /tmp/cc9NLGFL.o: In function <code>Matrix::scaleAddABtrans(Matrix const&amp;, Matrix const&amp;, float, float)':
    /home/ncelm/Matrix.cc:344: undefined reference to</code>cblas_sgemm'</p>
  </blockquote>
  
  <p>The function due to which the error is occuring:</p>
  
  <pre><code>void Matrix::scaleAddABtrans(const Matrix &amp;A, const Matrix &amp;B, float targetScale, float prodScale)
    {
    assert(A.rows() == rows() &amp;&amp; A.cols() == B.cols() &amp;&amp; B.rows() == cols());
    ::cblas_sgemm(CblasColMajor, CblasNoTrans, CblasTrans,
                  A.rows(), B.rows(), A.cols(),
                  prodScale, // Scale the product by 1
                  A.data(), A.rows(),
                  B.data(), B.rows(),
                  targetScale, // Scale the target by this before adding the product matrix
                  data(), rows());
  }
  </code></pre>
  
  <p>It is able to link the file but not find the <code>sgemm</code>. Unable to understand why?</p>