2

I honestly have spent too long Googling this.

I would like to setup MinGW-w64 so that I can simply pass the -w32 flag in order to create a 32-bit executable, and leave it as default to create a 64-bit executable.

During the setup of MinGW-w64, I have numerous options. For Architecture there is i686 and x86_64. For exception there is dwarf, SJIJ, and SEH.

This thread here (How do I compile and link a 32-bit Windows executable using mingw-w64) suggests that only SJIJ allows the -m32 flag to be passed in order to create a 32-bit binary, however I have found conflicting information elsewhere.

How can I set up MinGW so that I can easily both 32-bit and 64-bit architectures?

Thanks

Gary Allen
  • 1,218
  • 1
  • 13
  • 28
  • Do you mean the `-m32` flag? And if you want to be able to build 64-bit applications, then you must install the 64-bit variant. – Some programmer dude May 28 '20 at 18:39
  • 1
    What you're looking for is called a multilib mingw-w64 GCC toolchain. I haven't tried it, but I vaguely recall TDM-GCC is one of those. – David Macek May 29 '20 at 19:22
  • I was just confused as everyone on the internet says how MinGW-w64 is both 32-bit and 64-bit, but I didn't understand that still meant you had to install separate toolchains. – Gary Allen May 31 '20 at 07:36

1 Answers1

1

What I do is set up seperate MinGW-w64 toolchains, one for 32-bit and one for 64-bit Windows.

That way there is no confusion and the 2 won't ever accidentally get mixed up if some parameter is forgotten.

You ca get a recent version of both toolchains from http://winlibs.com/

Brecht Sanders
  • 6,215
  • 1
  • 16
  • 40