Compile 64-bit binary with MinGW (Dev-C++)

Adrian Maire picture Adrian Maire · Aug 1, 2013 · Viewed 32.7k times · Source

It is probably a stupid question but i was searching for the answer from about 3h.

¿How to compile 64-bit binary with (Dev-C++) MinGW?

I have readed that MinGW support 64bits by default, but i am unable to active this option.

I have tryed "-m64" but it say: "sorry, unimplemented: 64-bit mode not compiled in"

I am working on Dev-C++ on Windows-7

I know how to do it on MSVC++, but I don't want MSVC++ (cause of ethical issues)

What i am trying to compile, just for testing purpose:

#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{   
    // Test compiling mode
    if (sizeof(void*) == 8) cout << "Compiling 64-bits" << endl;
    else cout << "Compiling 32-bits" << endl;

    return 0;
}

Answer

greatwolf picture greatwolf · Aug 1, 2013

To build a 64-bit binary on windows you need the 64-bit version of the mingw compiler. Mingw-W64 is one possible distribution you can use. You can find a list of downloads here.

Additionally, you can also find Dev-C++ setup bundled with mingw 64-bit compiler under Orwell Dev-C++'s download section. Make sure you choose "TDM-GCC x64 4.7.1" either setup or portable.