I\'m trying to do a debug build of the Rabbyt library using mingw\'s gcc to run with my MSVC built python26_d.. I got a lot of undefined references which caused me to create
For those of you who don't have Visual Studio but would like to compile OpenCV from source with MinGW on Windows and run into this problem, here is my cmake command:
cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE=RELEASE -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.1.0/modules -D PYTHON_EXECUTABLE=C:/Users/your_user_name/Envs/cv/Scripts/python.exe -D BUILD_EXAMPLES=ON -D CMAKE_CXX_FLAGS="-DMS_WIN64 -w" ..
(For those unfamiliar: In "cmd.exe", create a folder called build in the opencv-3.1.0 folder which contains a file called CMakeLists.txt, cd into build, and issue the above command there. You can edit most of the parameters to your desire, I used virtual environment for Python here, but you don't have to.)
There is one more thing you'd need to do, which is to add
#include
#define _hypot hypot
before #include in opencv-3.1.0\modules\python\src2\cv2.cpp, which resolves the "undefined hypot" problem you might encounter, as suggested by relevant SO posts.
You would most likely compile without pain with e.g. make -j4 after these two tweaks.