22

I am programming in c++. I have installed mingw. I installed it from the standard installer from mingw website. I am confused between mingw32, mingw, mingw64. What are the differences and how can I check my version. Also when my programs are build, how would I know whether the executables created are 32 bit or 64 bit?

Sнаđошƒаӽ
  • 16,753
  • 12
  • 73
  • 90
Omkar
  • 791
  • 1
  • 9
  • 26

2 Answers2

31

mingw and mingw32 are for creating executables for 32-bit windows systems. mingw64 is for creating 64-bit executables. Note: this doesn't have to do with what version you are running when you do the build, but what the target system is for the executable you are creating (the system on which you will be running the newly created executable).

Regarding MinGW and MinGW32, here's a snippet from
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)."

To find out what version you have, go the the associated bin directory and do:

gcc --version

I'd recommend checking out minGW-w64, from here: http://mingw-w64.sourceforge.net/
That projects goal is to "deliver runtime, headers, and libs for developing 64 bit (x64), as well as 32 bit (x86), windows applications using gcc-4.6 or newer versions."

RobM
  • 3,588
  • 2
  • 19
  • 14
  • 7
    On my pc "gcc --version" outputs "gcc.exe (MinGW.org GCC-8.2.0-3) 8.2.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." So, it says the GCC version, not the MinGW version. How to get the MinGW version? – Santropedro Jul 17 '19 at 14:29
10

As indicated in the comments to the currently accepted answer gcc --version will not give the target information but rather the version of gcc itself.

Instead gcc -v will print verbose information about the environment of the compiler. Among it you will find either the 64 bit (as shown by "x86_64")

Target: x86_64-w64-mingw32

or the 32 bit (as shown by "i686")

Target: i686-w64-mingw32
thoni56
  • 3,145
  • 3
  • 31
  • 49