title: Using Eigen Library with OpenCV 2.3.1
body: <p>I have trouble in using <strong>Eigen3</strong> Library along with <strong>OpenCV</strong> application in <strong>C++</strong>.
  I have installed Eigen3 library on my Ubuntu using the following command:</p>
  
  <pre><code>sudo apt-get install libeigen3-dev
  </code></pre>
  
  <p>I am able to compile and use <strong>sample Eigen3 applications</strong> (Eigen3 library is installed and it works) when I use the following command to compile.</p>
  
  <pre><code>g++ -I/usr/include/eigen3 Eig.cpp -o Eig
  </code></pre>
  
  <p>I want to use the installed Eigen library with OpenCV.</p>
  
  <p>I compiled OpenCV source with following flags:</p>
  
  <pre><code>cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON USE_EIGEN=/usr/include/eigen3 ..
  </code></pre>
  
  <p>My OpenCV code includes the following headers and namespace:</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;assert.h&gt;
  #include &lt;opencv2/core/eigen.hpp&gt;
  
  using namespace cv;
  using namespace std;
  using namespace Eigen;
  </code></pre>
  
  <p><strong>However, when I normally compile OpenCV application, my compiler gives me the following error:</strong></p>
  
  <pre><code>In file included from Read.cpp:6:
  /usr/local/include/opencv2/core/eigen.hpp:54: error: expected ‘,’ or ‘...’ before ‘::’ token
  /usr/local/include/opencv2/core/eigen.hpp: In function ‘void cv::eigen2cv(int)’:
  /usr/local/include/opencv2/core/eigen.hpp:56: error: ‘src’ was not declared in this scope
  /usr/local/include/opencv2/core/eigen.hpp:56: error: ‘Eigen’ is not a class or namespace
  /usr/local/include/opencv2/core/eigen.hpp:60: error: ‘dst’ was not declared in this scope
  /usr/local/include/opencv2/core/eigen.hpp:66: error: ‘dst’ was not declared in this scope
  </code></pre>
  
  <p>How do I solve this problem?</p>