title: OpenCV build error
body: <p>If this is not out of place here, would like to know about the source and fix for an error I get when I am building OpenCV under Cygwin (On Windows 7 64 bit). </p>
  
  <p>I have Cygwin installed with MingW- pthread pacgae installed in that cygwin installation.</p>
  
  <p>I have downloaded OpenCV ver. 2.3.1 source package.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>After some tweaks, and changes to build process OpenCV builds fine now.
  But when I compile a simple test openCV code(C source code), as below it gives lot of linker errors of undefined references to many basic openCV functions. I tried setting LD_LIBRARY_PATH correctly but still errors persit:</p>
  
  <pre><code>cc -L/usr/local/lib -I/usr/local/include/opencv2 -/usr/local/include/opencv -lop                                                                                                                encv_imgproc -lopencv_highgui -lopencv_video -lopencv_calib3d test1.c -o test_op                                                                                                                encv
  cc: unrecognized option '-/usr/local/include/opencv'
  /tmp/ccfEqFK0.o:test1.c:(.text+0x9dd): undefined reference to `_cvFree_'
  /tmp/ccfEqFK0.o:test1.c:(.text+0xa4e): undefined reference to `_cvFree_'
  /tmp/ccfEqFK0.o:test1.c:(.text+0xb44): undefined reference to `_cvGetRows'
  /tmp/ccfEqFK0.o:test1.c:(.text+0xb6f): undefined reference to `_cvGetCols'
  /tmp/ccfEqFK0.o:test1.c:(.text+0xb82): undefined reference to `_cvReleaseMat'
  /tmp/ccfEqFK0.o:test1.c:(.text+0xcd2): undefined reference to `_cvAddS'
  
  /tmp/ccfEqFK0.o:test1.c:(.text+0x1137): undefined reference to `_cvRead'
  /tmp/ccfEqFK0.o:test1.c:(.text+0x11e1): undefined reference to `_cvLoadImage'
  /tmp/ccfEqFK0.o:test1.c:(.text+0x129d): undefined reference to `_cvCreateImage'
  /tmp/ccfEqFK0.o:test1.c:(.text+0x12dd): undefined reference to `_cvResize'
  /tmp/ccfEqFK0.o:test1.c:(.text+0x12f1): undefined reference to `_cvNamedWindow'
  /tmp/ccfEqFK0.o:test1.c:(.text+0x1305): undefined reference to `_cvNamedWindow'
                                             '
  /tmp/ccfEqFK0.o:test1.c:(.text+0x13ad): undefined reference to `_cvDestroyWindow                                                                            
  </code></pre>
  
  <p>... ... Many more undefined references.    </p>
  
  <pre><code>                              '
  collect2: ld returned 1 exit status
  Makefile:10: recipe for target `test_opencv' failed
  make: *** [test_opencv] Error 1
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Below message is still there, but it is not an error but a message during build process.</p>
  
  <p>*Then while building OpenCV under cygwin, when I do make , it gives a error message
      c++: unrecognized option '-pthread'
      [ 36%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_sunras.o*</p>
  
  <p>and for many other files i see the same error <code>c++: unrecognized option '-pthread'</code></p>
  
  <p>I would like to know if anyone has experience in building openCV under Cygwin , how to get OpenCV going under cygwin? . Now I know there is windows setup for OpenCV but that is not what is an option to me.</p>