Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW-W64: Which Install Options (Archtitecture, Threads, ...) must/should I Use for Native Windows Development

I want to install MinGW-W64 for Windows 10 64 Bit (must run on Version 1607!). First problem is which MinGW should I download, there are 3 versions on download page: 1) "MingW-W64-builds", 2) "Msys2", 3) "Win-Builds". I have choosen 1). If this was wrong for my purpose (see below) please tell me.

When I start the installer I have to choose the following options, which I'm not clear what to choose:

Architetcture: i686 or x86_64
Threads: posix or win32
Exception: dwarf or sjlj

Purpose (What I want to do)

I want (later) to install the CLang C++ 64 bit Compiler, which AFAIK requires the libraries from MinGW-64.

I want to write native Windows 64 bit C++ (at least C++ 14) and C applications (compiled with either GCC or CLang). I don't need a bash (or someone tells me a good reason why I should use it instead of the excellent Windows Powershell).

At a later time I want to be able to install an IDE (like Eclipse) which especially integrates the debugger (the one for GCC and if it is a different one for CLang that for CLang).

The sources should be as compatible as possible to sources which can be compiled with Visual Studio and the produced binaries should also be as compatible as possible with code produced with Visual Studio (unfortunately I cannot use VS Community version because of license reasons).

(Maybe this is usefull for answering: Python 2.7.11 and Python 3.7 are installed on my machine)

like image 542
Peter Sulzer Avatar asked Sep 02 '25 10:09

Peter Sulzer


1 Answers

MSYS2 is an environment that gives you a UNIX-like shell. You can use this if you need to use UNIX-like build tools (like autoconf). If that's not what you need, don't install it. Certainly don't build for MSYS as it's closer to Cygwin POSIX emulation than native Windows.

You will need a GCC compiler build against MinGW-w64. For example one of the MinGW-w64-builds from: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/

However, there don't seem to be any recent builds posted there, while there were newer releases of both GCC and the MinGW-w64 libraries. So I have built more recent versions and published them at: http://winlibs.com/

On http://winlibs.com/ there are also some instructions on how to compile from the command line and how to set up the compiler in the Code::Blocks IDE.

If you need Clang instead of GCC there are Windows binaries available at: http://releases.llvm.org/

However, you will still need the MinGW-w64 libraries to build for Windows using CLang. So if you're new to this, maybe you should just start with GCC before moving on to CLang.

Keeping your code compatible between compilers or even operating systems is up to the programmer. The key rule there is to avoid anything compiler or operating specific, and if you really must then enclose them in conditional defined (e.g. put the specific code between #ifdef __MINGW32__ or #ifdef _WIN32 and #endif).

like image 197
Brecht Sanders Avatar answered Sep 05 '25 02:09

Brecht Sanders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!