Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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;
}
like image 697
Adrian Maire Avatar asked Aug 01 '13 08:08

Adrian Maire


People also ask

Does MinGW support 64-bit?

MinGW-builds Provides both packages with a 32-bit and a 64-bit compiler (Windows host), that can also cross-compile to 32-bit or 64-bit. Packages are available with both "posix" and "win32" threading libraries, for 32 bit also with sjlj or dwarf exception variants. See also MSYS2.

How do I change my MinGW 32 bit to 64-bit?

open a cmd.exe and do set PATH=C:\mingw64\bin;%PATH% for 64-bit building. set PATH=C:\mingw32\bin;%PATH% for 32-bit building. You should be ready to go. Execute i686-w64-mingw32-gcc -v or x86_86-w64-mingw32-gcc -v to see that everything has gone well.

Does MinGW 32 work on 64-bit?

The MinGW Wiki "The project's name changed from mingw32 to MinGW is to prevent the implication that MinGW will only works on 32 bit systems (as 64 and higher bit machines become more common, MinGW will evolve to work with them)."


1 Answers

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.

like image 156
greatwolf Avatar answered Sep 29 '22 01:09

greatwolf