I changed to a TMD Mingw32 complier. This time everything went well except one that gcc 4.6 and later didn't recognize the -static-libstdc++ option. So I removed this option from the makefile. After that I SUCCESSFULLY built the whole project. I did't use a 64bit TMD Mingw, the 32bit TMD Mingw works well.