What is the difference between MinGW, MinGW-w64 and MinGW-builds? - c++

What are the differences between MinGW, MinGW-w64 and MinGW-builds?
And which one should I use to compile c++ 11 source code with the Eclipse IDE on a Windows 8 machine?

MinGW is a GCC-port for Windows. Not all of the Windows API is supported (but for many programs the supported stuff is sufficient) and it´s only for 32bit-Programs (which often can run on 64bit-Windows too, but some can´t, and you can´t compile them as 64bit).
MinGW-w64 is a improved version which supports both 32bit and 64bit, and some more of the WinAPI (still not all, because thats much work, but more than MinGW).
MinGW-w64 only provides their source code, but no binaries to "just use" the compiler.
MinGW-builds is a somewhat separate project to provide binaries in the most useful configurations. To get a specialized build of MinGW-w64, manual compiling is still possible.
Using the MinGW-builds self-installer is the easiest way, if nothing unusual is needed. Also see here for help with the self-installer.

Mingw compiles your code to Windows binaries that run under Windows.
Windows subsystem for Linux (WSL) makes Linux binaries. You can install other Linux programs under WSL, except if you need a graphical interface. You can access the Windows filesystem from WSL, but not vice versa.
Cygwin makes Windows binaries that can run under Windows outside the Cygwin shell, as long as you have the Cygwin DLL. This gives a Linux-like environment that is fully compatible with Windows.

Related

How to build a Qt C++ application that doesn't need VC Redistributables on a pc to run

I am building an application using Qt C++ and I want it to run on windows computers without having to install VC Redistributables. Apparently when user tries to run the application an error pops that says that VCRUNTIME140.dll is missing.
Build both Qt and your application using compiler option /MT?
https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170
I recommend using GCC (i.e. MinGW) as the compiler. If you do that, your app will generall depend on the msvcrt.dll that comes with Windows and doesn't need to be installed specially (but it depends on exactly how the GCC compiler is configured). It will also possibly depend on some GCC runtime library DLLs that you can just put in the same directory as your EXE.
MSYS2 is a good development environment for using MinGW on Windows: https://msys2.org
I also made a useful set of tools that is capable of cross-compiling statically-linked MinGW/Qt applications from Linux: https://github.com/DavidEGrayson/nixcrpkgs
The Qt applications I build with nixcrpkgs come out as single, standalone EXEs that do not need to be shipped with any DLLs.

whats the difference between mingw and mingw64 [duplicate]

What are the differences between MinGW, MinGW-w64 and MinGW-builds?
And which one should I use to compile c++ 11 source code with the Eclipse IDE on a Windows 8 machine?
MinGW is a GCC-port for Windows. Not all of the Windows API is supported (but for many programs the supported stuff is sufficient) and it´s only for 32bit-Programs (which often can run on 64bit-Windows too, but some can´t, and you can´t compile them as 64bit).
MinGW-w64 is a improved version which supports both 32bit and 64bit, and some more of the WinAPI (still not all, because thats much work, but more than MinGW).
MinGW-w64 only provides their source code, but no binaries to "just use" the compiler.
MinGW-builds is a somewhat separate project to provide binaries in the most useful configurations. To get a specialized build of MinGW-w64, manual compiling is still possible.
Using the MinGW-builds self-installer is the easiest way, if nothing unusual is needed. Also see here for help with the self-installer.
Mingw compiles your code to Windows binaries that run under Windows.
Windows subsystem for Linux (WSL) makes Linux binaries. You can install other Linux programs under WSL, except if you need a graphical interface. You can access the Windows filesystem from WSL, but not vice versa.
Cygwin makes Windows binaries that can run under Windows outside the Cygwin shell, as long as you have the Cygwin DLL. This gives a Linux-like environment that is fully compatible with Windows.

Using the mingw-w64 fork with the standard msys

I want to use GNU GCC on Windows so I've downloaded mingw, but the x86_64 fork.
Instead of using cmd, I want to use msys, but msys is designed for the standard 32bits version of minGW. I've moved the bin, lib, libexec etc folders from minGW-64 to the msys folder, combining folder if necessary.
I didn't need to modify my PATH and msys console recognize the gcc executables.
I'm wondering what could be the drawbacks (if any) of using a msys prepared for the 32bits version of minGW. I'm afraid that may be using a not optimized environment and that I could discover that at link time I may be linking 32bits symbols or using 32bits symbols at runtime instead of being full 64.
There a bit of confusing terminology here:
The mingw-w64 project worked on getting 64-bit support on Windows. However, the result of their efforts is both a 32-bit version and a 64-bit version. You should not be using the classic mingw at all, since it is horribly outdated.

GNU gcc and g++

Are the gcc and g++ compilers installed on a MAC OS X machine different from the ones on Ubuntu (Linux) GNU gcc and g++ compilers?
I am using Eclipse to develop a C++ program and there is toolchain section where it says MacOSX GCC and I was wondering if I need to install another compiler so that the executable would also run on Linux machines.
I am a bit new to the technical details of C++ development so I am sorry if this question does not make sense.
It it very unlikely that binary will execute on both Mac and on Linux. If is pretty likely that a binary will not execute between different distro's of Linux. You can either compile you binary for each OS. Or you can distribute the source code for you application and let you users compile it themselves.
Different versions of libstdc++.so are likely distributed with different OS's and this will cause you problems. A solution that partly works is to statically compile your binary so you are not depending on the target systems installed version of libraries.
MacOS is not Linux, it might have a bit in common with BSD, but definitely not Linux. They do, or can, use different configurations of the same compiler, but the programs are not compatible.
The only way you're going to run the same program on both is if you have something like Wine to provide a compatibility layer.

Cross-compiling python extensions under Linux using distutils

Is there any way to compile both Windows and Linux versions of Python/distutils/SWIG/C++ extensions under Linux? As far as I understand the problem is at least in obtaining windows version of python-dev.
Thank you.
You could do it in two ways:
Install MingW on your linux system, and cross-compile the extension using it
Compile it in a Windows Virtual Machine (eg. Windows7 on VirtualBox)
I prefer the second option as it gives the opportunity to test that your program is working