title: Issues compiling C (Not C++) OpenCV code
body: <p>I recently installed OpenCV from (<a href="http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/download" rel="nofollow noreferrer">http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/download</a>). Given what I'm trying to do at this point, I don't think it would make a difference using the Ubuntu (12.0.4) repository. That is its very basic functionality.</p>
  
  <p>I'm able to run the C++ code located at <a href="http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html" rel="nofollow noreferrer">http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html</a> with no problems. </p>
  
  <p>However my problems begin when I'm trying to use the pure C aspects of OpenCV.</p>
  
  <p>I'm trying to compile the following C code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;cv.h&gt;
  #include &lt;highgui.h&gt;
  
  int main(int argc, char** argv){
  
      if ( argc != 2 ){
          printf("usage: DisplayImage.out &lt;Image_Path&gt;\n");
          return -1;
      }
  
      IplImage* img = cvLoadImage( argv[1], CV_LOAD_IMAGE_COLOR );
      cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
      cvShowImage("Example1", img);
      cvWaitKey(0);
      cvReleaseImage( &amp;img );
      cvDestroyWindow( "Example1" );
      return 0;
  }
  </code></pre>
  
  <p>using the following command line</p>
  
  <pre><code>gcc DisplayImage.c -o DisplayImage.out -I /usr/local/include/opencv -L /usr/local/lib -lm -lcv -lhighgui -lcvaux
  </code></pre>
  
  <p>But am getting the following errors</p>
  
  <pre><code>/usr/bin/ld: cannot find -lcv
  /usr/bin/ld: cannot find -lhighgui
  /usr/bin/ld: cannot find -lcvaux
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>After taking a look at a similar post (see <a href="https://stackoverflow.com/questions/18029712/cannot-find-opencv-libraries-in-ubuntu-12-04">https://stackoverflow.com/questions/18029712/cannot-find-opencv-libraries-in-ubuntu-12-04</a>), I ran the command </p>
  
  <pre><code>$ pkg-config --cflags opencv
  </code></pre>
  
  <p>and got</p>
  
  <pre><code>-I/usr/local/include/opencv
  -I/usr/local/include  
  </code></pre>
  
  <p>I also ran</p>
  
  <pre><code>$ pkg-config --libs opencv
  </code></pre>
  
  <p>and got</p>
  
  <pre><code>/usr/local/lib/libopencv_calib3d.so
  /usr/local/lib/libopencv_contrib.so
  /usr/local/lib/libopencv_core.so
  /usr/local/lib/libopencv_features2d.so
  /usr/local/lib/libopencv_flann.so
  /usr/local/lib/libopencv_gpu.so
  /usr/local/lib/libopencv_highgui.so
  /usr/local/lib/libopencv_imgproc.so
  /usr/local/lib/libopencv_legacy.so 
  /usr/local/lib/libopencv_ml.so 
  /usr/local/lib/libopencv_nonfree.so 
  /usr/local/lib/libopencv_objdetect.so 
  /usr/local/lib/libopencv_ocl.so 
  /usr/local/lib/libopencv_photo.so 
  /usr/local/lib/libopencv_stitching.so 
  /usr/local/lib/libopencv_superres.so 
  /usr/local/lib/libopencv_ts.a 
  /usr/local/lib/libopencv_video.so 
  /usr/local/lib/libopencv_videostab.so 
  -lrt 
  -lpthread 
  -lm
  -ldl 
  </code></pre>
  
  <p>Somehow this last part looks alot different than I would expect (different from the output in the previous post). I could be wrong, so please be patient with me as I'm still a Linux novice.</p>
  
  <p>Would using the downloaded ZIP instead of the repository packages cause this, or is there something else I'm not understanding.</p>