I\'m using python3.6 theano, with mingw-w64-x86-64 installed, my os is Win10_64, cuda installed, and seems everything is ok
the theano.test() is ok, saying my gpu
(This answer was posted in comments originally)
I had to keep the original mingw cmath header (otherwise libpng would not build) and I commented out the #define hypot _hypot in pyconfig.h (line 241).
#define hypot _hypot
pyconfig.h