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
I just solved this problem by adding the compiler flag -DPy_TRACE_DEFS. In my case I was trying to build debug versions of SIP/PyQt.
The error can occur when the debug version of Python is compiled with the Py_TRACE_DEFS option switched on. This causes the resulting python2x_d library to contain the function Py_InitModule4TraceRefs instead of Py_InitModule4 that the compiler is looking for (amongst other changes). Switching the option on for the project you are building ensures the code produced is compatible, and that the correct version of Py_InitModule4 is found.
More information on Py_TRACE_DEFS can be found in Misc/SpecialBuilds.txt in the Python source folder or here.