title: OPENCV error: undefined reference to "cvLoadImage"
body: <p>I have two files:</p>
  
  <p>test.cpp :</p>
  
  <pre><code>#include "highgui.h"
  #include &lt;cv.h&gt;
  int main( int argc, char** argv ) {
      IplImage* img = cvLoadImage( argv[1] );
      cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
      cvShowImage( "Example1", img );
      cvWaitKey(0);
      cvReleaseImage( &amp;img );
      cvDestroyWindow( "Example1" );
  }
  </code></pre>
  
  <p>CMakeLists.txt:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  set(CMAKE_MODULE_PATH ${/home/jinder1s/Documents/project/opencv/FindOpenCV.make} )
  project(hello)
  Find_package (OpenCV REQUIRED)
  if(OpenCV_FOUND)
      add_executable (Hello test.cpp)
      find_library(Opencv_lib 
      NAMES opencv_core opencv_highgui opencv_imgproc
      PATHS /usr/local/lib)
  endif()
  </code></pre>
  
  <p>this is the template for what I got.</p>
  
  <pre><code>jinder1s@jinder1s-lat-lap:~/Documents/project/opencv/tests$ cmake .
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/jinder1s/Documents/project/opencv/tests
  jinder1s@jinder1s-lat-lap:~/Documents/project/opencv/tests$ make
  Linking CXX executable Hello
  CMakeFiles/Hello.dir/test.cpp.o: In function `main':
  test.cpp:(.text+0x1d): undefined reference to `cvLoadImage'
  test.cpp:(.text+0x35): undefined reference to `cvNamedWindow'
  test.cpp:(.text+0x49): undefined reference to `cvShowImage'
  test.cpp:(.text+0x55): undefined reference to `cvWaitKey'
  test.cpp:(.text+0x61): undefined reference to `cvReleaseImage'
  test.cpp:(.text+0x6d): undefined reference to `cvDestroyWindow'
  collect2: error: ld returned 1 exit status
  make[2]: *** [Hello] Error 1
  make[1]: *** [CMakeFiles/Hello.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>I just started learning opencv, as in this is my first code, and I just can't seem to get it to work. I could really use some help here. Can't see what I'm doing wrong.</p>