title: OpenCV 2.3 doesn't compile, undefined reference error
body: <p>I'm using OpenCV in Windows 7 64bits and Netbeans 7.0. I tried to compile the next code using MinGW and cygwin but both fails with undefined references.</p>
  
  <p>When I use MAT or FLANN and others I can't compile, but I'm adding all libraries (I tried only adding Debug ones, Release ones, only needed ones... but fails).</p>
  
  <p>The same code in ubuntu works, but I need to compile it in windows too. I'm using the 2.3 compiled version (using CMake) and the installable one.</p>
  
  <pre><code>#include "opencv2\opencv.hpp"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(void)
  {
      cv::Mat::eye(1, 1, 0);
  
      return 0;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
  make[1]: Entering directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
  rm -f -r build/Release
  rm -f dist/Release/Cygwin-Windows/opencv23sandbox.exe
  make[1]: Leaving directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
  
  CLEAN SUCCESSFUL (total time: 1s)
  "/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
  make[1]: Entering directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
  "/usr/bin/make"  -f nbproject/Makefile-Release.mk dist/Release/Cygwin-Windows/opencv23sandbox.exe
  make[2]: Entering directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
  mkdir -p build/Release/Cygwin-Windows
  rm -f build/Release/Cygwin-Windows/main.o.d
  g++.exe    -c -O2 -I/cygdrive/C/OpenCV2.3/build/include -MMD -MP -MF build/Release/Cygwin-Windows/main.o.d -o build/Release/Cygwin-Windows/main.o main.cpp
  mkdir -p dist/Release/Cygwin-Windows
  g++.exe     -o dist/Release/Cygwin-Windows/opencv23sandbox build/Release/Cygwin-Windows/main.o -L/cygdrive/C/OpenCV2.3/build/x86/vc10/lib -lopencv_calib3d230 -lopencv_calib3d230d -lopencv_contrib230 -lopencv_contrib230d -lopencv_core230 -lopencv_core230d -lopencv_features2d230 -lopencv_features2d230d -lopencv_flann230 -lopencv_flann230d -lopencv_gpu230 -lopencv_gpu230d -lopencv_haartraining_engine -lopencv_haartraining_engined -lopencv_highgui230 -lopencv_highgui230d -lopencv_imgproc230 -lopencv_imgproc230d -lopencv_legacy230 -lopencv_legacy230d -lopencv_ml230 -lopencv_ml230d -lopencv_objdetect230 -lopencv_objdetect230d -lopencv_video230 -lopencv_video230d 
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0xac): undefined reference to `cv::Mat::eye(int, int, int)'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x106): undefined reference to `cv::fastFree(void*)'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x16f): undefined reference to `cv::fastFree(void*)'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x1dd): undefined reference to `cv::fastFree(void*)'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x1fa): undefined reference to `cv::Mat::deallocate()'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x20a): undefined reference to `cv::Mat::deallocate()'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text+0x21a): undefined reference to `cv::Mat::deallocate()'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x66): undefined reference to `cv::Mat::deallocate()'
  build/Release/Cygwin-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x5e): undefined reference to `cv::fastFree(void*)'
  collect2: ld returned 1make[2]: Leaving directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
  make[1]: Leaving directory `/cygdrive/f/Proyectos/C++/OpenCV23Sandbox'
   exit status
  make[2]: *** [dist/Release/Cygwin-Windows/opencv23sandbox.exe] Error 1
  make[1]: *** [.build-conf] Error 2
  make: *** [.build-impl] Error 2
  
  BUILD FAILED (exit value 2, total time: 2s)
  </code></pre>
  
  <hr>
  
  <p>Trying with MinGW libs:</p>
  
  <pre><code>"/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
  make[1]: Entering directory `/f/Proyectos/C++/OpenCV23Sandbox'
  rm -f -r build/Release
  rm -f dist/Release/MinGW-Windows/opencv23sandbox.exe
  make[1]: Leaving directory `/f/Proyectos/C++/OpenCV23Sandbox'
  
  CLEAN SUCCESSFUL (total time: 350ms)
  "/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
  make[1]: Entering directory `/f/Proyectos/C++/OpenCV23Sandbox'
  "/bin/make"  -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/opencv23sandbox.exe
  make[2]: Entering directory `/f/Proyectos/C++/OpenCV23Sandbox'
  mkdir -p build/Release/MinGW-Windows
  rm -f build/Release/MinGW-Windows/main.o.d
  g++.exe    -c -O2 -I/C/OpenCV2.3/build/include -MMD -MP -MF build/Release/MinGW-Windows/main.o.d -o build/Release/MinGW-Windows/main.o main.cpp
  mkdir -p dist/Release/MinGW-Windows
  g++.exe     -o dist/Release/MinGW-Windows/opencv23sandbox build/Release/MinGW-Windows/main.o -L../OpenCV/OpenCV2.3/build/x86/mingw/lib ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_calib3d230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_contrib230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_core230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_features2d230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_flann230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_gpu230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_highgui230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_imgproc230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_legacy230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_ml230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_objdetect230.dll.a ../OpenCV/OpenCV2.3/build/x86/mingw/lib/libopencv_video230.dll.a 
  build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x4f): undefined reference to `cv::Mat::eye(int, int, int)'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text+0xac): undefined reference to `cv::fastFree(void*)'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x11a): undefined reference to `cv::fastFree(void*)'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x191): undefined reference to `cv::fastFree(void*)'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x1a7): undefined reference to `cv::Mat::deallocate()'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x1ba): undefined reference to `cv::Mat::deallocate()'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text+0x1ce): undefined reference to `cv::Mat::deallocate()'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x74): undefined reference to `cv::Mat::deallocate()'
  build/Release/MinGW-Windows/main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[cv::Mat::~Mat()]+0x63): undefined reference to `cv::fastFree(void*)'
  collect2: ld returned 1 exit status
  make[2]: Leaving directory `/f/Proyectos/C++/OpenCV23Sandbox'
  make[1]: Leaving directory `/f/Proyectos/C++/OpenCV23Sandbox'
  make[2]: *** [dist/Release/MinGW-Windows/opencv23sandbox.exe] Error 1
  make[1]: *** [.build-conf] Error 2
  make: *** [.build-impl] Error 2
  
  BUILD FAILED (exit value 2, total time: 1s)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>g++.exe     -o dist/Release/MinGW-Windows/opencv23sandbox build/Release/MinGW-Windows/main.o -L../OpenCV/OpenCV2.3/build/x86/mingw/lib -lopencv_calib3d230.dll -lopencv_contrib230.dll -lopencv_core230.dll -lopencv_features2d230.dll -lopencv_flann230.dll -lopencv_gpu230.dll -lopencv_highgui230.dll -lopencv_imgproc230.dll -lopencv_legacy230.dll -lopencv_ml230.dll -lopencv_objdetect230.dll -lopencv_video230.dll 
  </code></pre>
  
  <p>same result.</p>