title: Make fails at 98% Linking CXX shared module ..\..\lib\cv2.pyd
body: <p>I try to build opencv 3.4.0 in code blocks (windows 7) with mingw 0.6.2 but at 98% I have five error related with python and I don't know why.</p>
  
  <p>This is the build log in codeblocks:</p>
  
  <pre><code>[ 98%] Linking CXX shared module ..\..\lib\cv2.pyd
  cd /d C:\OpenCV\pepito\modules\python2 &amp;&amp; C:\Users\Rafa\Documents\cmake\cmake-3.10.3-win64-x64\bin\cmake.exe -E cmake_link_script CMakeFiles\opencv_python2.dir\link.txt --verbose=1
  C:\Users\Rafa\Documents\cmake\cmake-3.10.3-win64-x64\bin\cmake.exe -E remove -f CMakeFiles\opencv_python2.dir/objects.a
  C:\TDM-GCC-64\bin\ar.exe cr CMakeFiles\opencv_python2.dir/objects.a @CMakeFiles\opencv_python2.dir\objects1.rsp
  C:\TDM-GCC-64\bin\g++.exe     -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations  -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unused-function -Wno-overloaded-virtual -Wno-undef -Wno-deprecated-declarations -O3 -DNDEBUG  -DNDEBUG  -shared -o ..\..\lib\cv2.pyd -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles\opencv_python2.dir/objects.a -Wl,--no-whole-archive @CMakeFiles\opencv_python2.dir\linklibs.rsp
  CMakeFiles\opencv_python2.dir/objects.a(cv2.cpp.obj):cv2.cpp:(.text$initcv2+0x2bbe): undefined reference to `__imp_Py_InitModule4'
  collect2.exe: error: ld returned 1 exit status
  mingw32-make.exe[2]: *** [lib/cv2.pyd] Error 1
  mingw32-make.exe[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
  mingw32-make.exe: *** [all] Error 2
  modules\python2\CMakeFiles\opencv_python2.dir\build.make:114: recipe for target 'lib/cv2.pyd' failed
  mingw32-make.exe[2]: Leaving directory 'C:/OpenCV/pepito'
  CMakeFiles\Makefile2:4081: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
  mingw32-make.exe[1]: Leaving directory 'C:/OpenCV/pepito'
  C:/OpenCV/pepito/Makefile:161: recipe for target 'all' failed
  Process terminated with status 2 (0 minute(s), 25 second(s))
  5 error(s), 0 warning(s) (0 minute(s), 25 second(s))
  </code></pre>
  
  <p>And thast the buid messages:</p>
  
  <pre><code>||=== Build: all in OpenCV (compiler: GNU GCC Compiler) ===|
  CMakeFiles\opencv_python2.dir\objects.a(cv2.cpp.obj)cv2.cpp:(.text$initcv2+0x2bbe)||undefined reference to `__imp_Py_InitModule4'|
  ||error: ld returned 1 exit status|
  modules\python2\CMakeFiles\opencv_python2.dir\build.make|114|recipe for target 'lib/cv2.pyd' failed|
  CMakeFiles\Makefile2|4081|recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed|
  C:\OpenCV\pepito\Makefile|161|recipe for target 'all' failed|
  ||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 25 second(s)) ===|
  </code></pre>
  
  <p>Any help in solving this issue would be much appreciated :)</p>