title: Use opencv C++ on raspberry pi 2
body: <p>I am successfully running opencv python code on raspberry pi 2 (raspbian).
  Now I want to try to compile opencv C++ code on raspberry pi 2 by using this command:</p>
  
  <pre><code>g++ -std=c++0x test_colour_tracking_1.cpp -otest_colour
  </code></pre>
  
  <p>The C++ coding as below.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  using namespace cv;
  using namespace std;
  int main(int argc, char** argv)
  {
      VideoCapture cap(0); //capture the video from web cam
      if ( !cap.isOpened() )  // if not success, exit program
      {
           cout &lt;&lt; "Cannot open the web cam" &lt;&lt; endl;
           return -1;
      }
      while (true)
      {
          Mat imgOriginal;    
          bool bSuccess = cap.read(imgOriginal); // read a new frame from video
  
          if (!bSuccess) //if not success, break loop
          {
               cout &lt;&lt; "Cannot read a frame from video stream" &lt;&lt; endl;
               break;
          }
      imshow("image",imgOriginal);
      }
      return 0;
  }
  </code></pre>
  
  <p>But it show error as below.</p>
  
  <pre><code>/tmp/ccHcCqSm.o: In function `main':
  test_colour_tracking_1.cpp:(.text+0x70): undefined reference to `cv::VideoCapture::VideoCapture(int)'
  test_colour_tracking_1.cpp:(.text+0x7c): undefined reference to `cv::VideoCapture::isOpened() const'
  test_colour_tracking_1.cpp:(.text+0xd8): undefined reference to `cv::VideoCapture::read(cv::Mat&amp;)'
  test_colour_tracking_1.cpp:(.text+0x150): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&amp;)'
  test_colour_tracking_1.cpp:(.text+0x164): undefined reference to `cv::imshow(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, cv::_InputArray const&amp;)'
  test_colour_tracking_1.cpp:(.text+0x1a4): undefined reference to `cv::VideoCapture::~VideoCapture()'
  test_colour_tracking_1.cpp:(.text+0x1f0): undefined reference to `cv::VideoCapture::~VideoCapture()'
  /tmp/ccHcCqSm.o: In function `cv::Mat::~Mat()':
  test_colour_tracking_1.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x3c): undefined reference to `cv::fastFree(void*)'
  /tmp/ccHcCqSm.o: In function `cv::Mat::release()':
  test_colour_tracking_1.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x58): undefined reference to `cv::Mat::deallocate()'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>And I want to ask how to check frame rate per second?</p>