title: Sample Program From Terminal Could Not Run
body: <p>I'm new to opencv in ubuntu.  I've follow the tutorial from <a href="http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html" rel="nofollow">here</a> for setting up the opencv in linux. However, I have failed to make the <a href="http://docs.opencv.org/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html" rel="nofollow">sample program</a> runs. After I type the following,</p>
  
  <pre><code>$ g++ DisplayImage.cpp
  </code></pre>
  
  <p>These error appears,</p>
  
  <pre><code>/tmp/cc3GTOtQ.o: In function `main':
  DisplayImage.cpp:(.text+0x53): undefined reference to `cv::imread(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, int)'
  DisplayImage.cpp:(.text+0xe5): undefined reference to `cv::namedWindow(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, int)'
  DisplayImage.cpp:(.text+0x113): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&amp;)'
  DisplayImage.cpp:(.text+0x147): 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;)'
  DisplayImage.cpp:(.text+0x169): undefined reference to `cv::waitKey(int)'
  /tmp/cc3GTOtQ.o: In function `cv::Mat::~Mat()':
  DisplayImage.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
  /tmp/cc3GTOtQ.o: In function `cv::Mat::operator=(cv::Mat const&amp;)':
  DisplayImage.cpp:(.text._ZN2cv3MataSERKS0_[cv::Mat::operator=(cv::Mat const&amp;)]+0x111): undefined reference to `cv::Mat::copySize(cv::Mat const&amp;)'
  /tmp/cc3GTOtQ.o: In function `cv::Mat::release()':
  DisplayImage.cpp:(.text._ZN2cv3Mat7releaseEv[cv::Mat::release()]+0x47): undefined reference to `cv::Mat::deallocate()'
  collect2: ld returned 1 exit status
  </code></pre>