title: OpenCV 3.0 undefined reference error?
body: <p>I've just followed the instructions to install opencv 3 on my ubuntu computer (I've already installed and ran programs using opencv 3 on a different linux device), however, when I tried to run one of my test programs from my old computer I get the following errors:</p>
  
  <pre><code>CMakeFiles/VideoTest.dir/VideoTest.cpp.o: In function `main':
  VideoTest.cpp:(.text+0x6f): undefined reference to `cv::VideoWriter::fourcc(char,char,char, char)'
  VideoTest.cpp:(.text+0xc3): undefined reference to `cv::VideoWriter::open(cv::String const&amp;, int, double, cv::Size_&lt;int&gt;, bool)'
  VideoTest.cpp:(.text+0x103): undefined reference to `cv::namedWindow(cv::String const&amp;, int)'
  VideoTest.cpp:(.text+0x146): undefined reference to `cv::VideoCapture::read(cv::_OutputArray const&amp;)'
  VideoTest.cpp:(.text+0x1b1): undefined reference to `cv::imshow(cv::String const&amp;, cv::_InputArray const&amp;)'
  CMakeFiles/VideoTest.dir/VideoTest.cpp.o: In function `cv::String::String(char const*)':
  VideoTest.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x3b): undefined reference to `cv::String::allocate(unsigned int)'
  CMakeFiles/VideoTest.dir/VideoTest.cpp.o: In function `cv::String::~String()':
  VideoTest.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0xd): undefined reference to `cv::String::deallocate()'
  collect2: ld returned 1 exit status
  make[2]: *** [VideoTest] Error 1
  make[1]: *** [CMakeFiles/VideoTest.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>Any idea what's going on? I'm relatively new to opencv. Here's my test code for reference:</p>
  
  <pre><code>#include "opencv2/highgui/highgui.hpp"
  #include "opencv2/opencv.hpp"
  #include &lt;iostream&gt;
  
  using namespace cv;
  using namespace std;
  
  int main(int argc, char* argv[]){
      VideoCapture vCap(0);
      VideoWriter vWrite;
      vWrite.open("test.avi", vWrite.fourcc('M','J','P','G'), 20, Size(640, 480), true);
      while (1) {
          namedWindow("VideoFeed", WINDOW_AUTOSIZE);
          Mat frame;
          vCap.read(frame);
          vWrite.write(frame);
          imshow("VideoFeed", frame);
          char c = waitKey(50);
          if (c == 27) {
              break;
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: My CMakeLists.txt:    </p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  project(VideoTest)
  find_package(OpenCV REQUIRED)
  add_executable(VideoTest VideoTest.cpp)
  target_link_libraries(VideoTest ${OpenCV_LIBS})
  </code></pre>