title: Compiling C++ code using openCV in Beaglebone
body: <p>I have written the following code in C++ which use openCV to be run in Beaglebone:</p>
  
  <pre><code>    #include &lt;unistd.h&gt;
      #include &lt;stdlib.h&gt;
      #include &lt;stdio.h&gt;
      #include &lt;string.h&gt;
      #include &lt;errno.h&gt;
      #include &lt;fcntl.h&gt;
      #include &lt;termios.h&gt;
      #include &lt;sys/types.h&gt;
      #include &lt;sys/stat.h&gt;
      #include &lt;netinet/in.h&gt;
      #include "opencv/cv.h"
      #include "opencv/highgui.h" 
  
      using namespace cv;
      using namespace std;
  
      int main(int argc, char *argv[])
      {
           CvCapture *capture = 0;
           Mat img3;
           Mat src;
  
           capture = cvCaptureFromCAM(0);
  
           vector&lt;int&gt; p;
           p.push_back(CV_IMWRITE_PNG_COMPRESSION);
           p.push_back(9);
  
           while (1) {
                img3 = cvQueryFrame(capture);
                cvtColor(img3, img3, CV_BGR2GRAY);
                pyrDown(img3, src, Size( img3.cols/2, img3.rows/2 ) );
                if (!imwrite("/home/root/Desktop/website/fig3bmp.bmp",src,p)) {
                    printf("mat not saved!!!\n"); 
                }
           }
  
           return 0; 
      }
  </code></pre>
  
  <p>I have tried compiling the code using: "g++ -o CamaraTest CamaraTest.cpp", but it does not work, and all the errors I get are something like: "undefined reference to: cv... "</p>
  
  <p>I have already checked that the files "cv.h" and "highgui.h" are in the directory "/usr/include/opencv".</p>
  
  <p>How can I compile this code?
  Any suggestion would help a lot.</p>
  
  <p>Thanks in advance.</p>
  
  <p>gus.</p>