Build failed: sorry, unimplemented: 64-bit mode not compiled in

I am trying to build a project with ggez on Windows, but this error comes up when it tried to build bzip2-sys:

cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

Currently I am using mingw as my compiler.
What could this error mean?

Which "mingw", there's like 10 of them.

It means you have Rust set to compile for 64-bit CPU, and have outdated mingw that is for legacy 32-bit CPUs. Both must use the same CPU architecture.

You can switch Rust to use 32-bit with:

rustup default i686-pc-windows-gnu

or you can install Visual Studio with C++ SDK and switch to a better-supported MSVC 64-bit target

rustup default x86_64-pc-windows-msvc

Ok, I did the first command you wrote, and it almost worked, but I got this error when it got to compiling my project:
error: linking with `i686-w64-mingw32-gcc` failed: exit code: 1 c:/mingw/include/stdlib.h:586: undefined reference to `__mingw_free'