title: Can't Compile Cython on Windows with MingW
body: <p>On Windows 10 Build 14393 with Python 3.7.0, Cython 0.29.6 and MinGW32 located at <code>C:\MinGW</code> with the path <code>C:\MinGW\bin</code> on the system <code>PATH</code> environment variable, <strong>I am unable to get Cython code to compile using MingW.</strong>  When I attempt to, I receive the following:</p>
  
  <pre><code>running build_ext
  building 'abc_image_stats' extension
  error: Unable to find vcvarsall.bat
  c:\program files\python\python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  </code></pre>
  
  <p>I have tried various fixes, such as those mentioned <a href="https://stackoverflow.com/a/43971456">here</a>, to no avail.  After making the config file as instructed in that solution, (but before changing cgwinccompiler.py), I attempted to compile again but then received this error:</p>
  
  <pre><code>running build_ext
  Traceback (most recent call last):
    File "setup.py", line 7, in &lt;module&gt;
      include_dirs=[numpy.get_include()] # https://stackoverflow.com/a/14657667
    File "C:\Program Files\Python\Python37\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Program Files\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Program Files\Python\Python37\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Program Files\Python\Python37\lib\distutils\command\build_ext.py", line 308, in run
      force=self.force)
    File "C:\Program Files\Python\Python37\lib\distutils\ccompiler.py", line 1031, in new_compiler
      return klass(None, dry_run, force)
    File "C:\Program Files\Python\Python37\lib\distutils\cygwinccompiler.py", line 282, in __init__
      CygwinCCompiler.__init__ (self, verbose, dry_run, force)
    File "C:\Program Files\Python\Python37\lib\distutils\cygwinccompiler.py", line 157, in __init__
      self.dll_libraries = get_msvcr()
    File "C:\Program Files\Python\Python37\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr
      raise ValueError("Unknown MS Compiler version %s " % msc_ver)
  ValueError: Unknown MS Compiler version 1914
  c:\program files\python\python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  </code></pre>
  
  <p>So then I did the last two steps; I added</p>
  
  <pre><code>elif msc_ver == '1914':
              # Visual Studio 2015 / Visual C 14.0
              # "msvcr140.dll no longer exists" http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
              return ['vcruntime140']
  </code></pre>
  
  <p>to the cygwinccompiler.py file and copied vcruntime140.dll to the <code>C:\Program Files\Python\Python37\libs</code> folder, but then I receive this error upon attempting to compile:</p>
  
  <pre><code>running build_ext
  building 'abc_image_stats' extension
  C:\MinGW\bin\gcc.exe -mdll -O -Wall "-IC:\Program Files\Python\Python37\lib\site-packages\numpy\core\include" "-IC:\Program Files\Python\Python37\include" "-IC:\Program Files\Python\Python37\include" -c abc_image_stats.c -o build\temp.win-amd64-3.7\Release\abc_image_stats.o
  In file included from C:\Program Files\Python\Python37\include/Python.h:68:0,
                   from abc_image_stats.c:4:
  C:\Program Files\Python\Python37\include/pytime.h:123:59: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
   PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv);
                                                             ^~~~~~~
  C:\Program Files\Python\Python37\include/pytime.h:130:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
       struct timeval *tv,
              ^~~~~~~
  C:\Program Files\Python\Python37\include/pytime.h:135:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
       struct timeval *tv,
              ^~~~~~~
  writing build\temp.win-amd64-3.7\Release\abc_image_stats.cp37-win_amd64.def
  C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.7\Release\abc_image_stats.o build\temp.win-amd64-3.7\Release\abc_image_stats.cp37-win_amd64.def "-LC:\Program Files\Python\Python37\libs" "-LC:\Program Files\Python\Python37\PCbuild\amd64" -lpython37 -lvcruntime140 -o C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.cp37-win_amd64.pyd
  C:\Program Files\Python\Python37\libs/libpython37.a: error adding symbols: File format not recognized
  collect2.exe: error: ld returned 1 exit status
  error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
  c:\program files\python\python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  </code></pre>
  
  <p>To be clear, my setup.py file looks like this:</p>
  
  <pre><code>from distutils.core import setup
  from Cython.Build import cythonize
  import numpy
  
  setup(
      ext_modules = cythonize("abc_image_stats.pyx"),
      include_dirs=[numpy.get_include()] # https://stackoverflow.com/a/14657667
  )
  </code></pre>
  
  <p>and I am attempting to compile using <code>python setup.py build_ext --inplace</code> via the command line.</p>
  
  <p><strong>All I want to do is compile the Cython code on a Windows 10 machine using MingW</strong>.  I've tried everything I can think of and don't know what's wrong.  Any ideas on how to solve this?</p>