title: C++ - Symbols no found when building with eigen
body: <p>I am trying to use the Eigen library. But when I try to compile under OSX Mavericks using XCode I get the following error message:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "buildProblem(std::__1::vector&lt;Eigen::Triplet&lt;double, int&gt;,  std::__1::allocator&lt;Eigen::Triplet&lt;double, int&gt; &gt; &gt;&amp;, Eigen::Matrix&lt;double, -1, 1, 0, -1, 1&gt;&amp;, int)", referenced from:
    _main in main.o
    "saveAsBitmap(Eigen::Matrix&lt;double, -1, 1, 0, -1, 1&gt; const&amp;, int, char const*)", referenced from:
    _main in main.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>What can be wrong with my code or settings? Here you can see my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;/usr/local/include/Eigen/Eigen/Sparse&gt;
  #include &lt;vector&gt;
  
  
  typedef Eigen::SparseMatrix&lt;double&gt; SpMat; // declares a column-major sparse matrix type of double
  typedef Eigen::Triplet&lt;double&gt; T;
  void buildProblem(std::vector&lt;T&gt;&amp; coefficients, Eigen::VectorXd&amp; b, int n);
  void saveAsBitmap(const Eigen::VectorXd&amp; x, int n, const char* filename);
  
  
  
  int main(int argc, char** argv)
  {
      int n = 300;  // size of the image
     int m = n*n;  // number of unknows (=number of pixels)
      // Assembly:
      std::vector&lt;T&gt; coefficients;            // list of non-zeros coefficients
      Eigen::VectorXd b(m);                   // the right hand side-vector resulting from the constraints
      buildProblem(coefficients, b, n);
      SpMat A(m,m);
      A.setFromTriplets(coefficients.begin(), coefficients.end());
      // Solving:
      Eigen::SimplicialCholesky&lt;SpMat&gt; chol(A);  // performs a Cholesky factorization of A
      Eigen::VectorXd x = chol.solve(b);         // use the factorization to solve for the given right hand side
      // Export the result to a file:
      saveAsBitmap(x, n, argv[1]);
      return 0;
  }
  </code></pre>