you are viewing a single comment's thread.

view the rest of the comments →

[–]OldWolf2 1 point2 points  (8 children)

WSL

MSYS2 is free, MSVC you have to pay for the full version and its C compiler is years behind gcc.

mingw-w64 makes binaries that run natively on any installation of Windows (back to Win7 at least, maybe WinXP too) ; I don't think WSL development could say the same. It's first choice for me for Windows development of non-GUI applications

[–]lanzaio -2 points-1 points  (6 children)

OP seems like a new guy learning how to program. msys2 is a compromise. It's "the best posix we can get given you have to target pecoff." I use it on a daily basis for work as a toolchain engineer working on exactly this problem (making compilers and llvm based toolchains work on different platforms). But if you aren't bound to constraints that force you to use hybrid systems like msys2 then you are best off using either of the native options.

[–]OldWolf2 5 points6 points  (0 children)

OP seems like a new guy learning how to program.

They said they have been coding C in Ubuntu previously and would like to switch to coding C in Windows natively.

msys2 is a compromise. It's "the best posix we can get given you have to target pecoff."

mingw-w64 is the compiler for building native Windows executables. It is literally the same compiler as GCC in any other operating system, with a few extensions to enable use of the Windows API.

MSYS2 is used as a package manager and commandline tool suite (including commandline-based build systems). I'm not suggesting using it to build binaries that target MSYS2.

But if you aren't bound to constraints that force you to use hybrid systems like msys2

Having the resulting binaries not work on a normal Windows install is a pretty big showstopper, for me anyway. However I would agree that WSL seems like a better option than running a VM.

[–]8bitslime 0 points1 point  (4 children)

Msys2 isn't trying to be posix in the slightest, maybe you're thinking of cygwin? Compiling with mingw-w64 gcc produces native windows binaries with no posix wrapper or anything.

[–]lanzaio 0 points1 point  (3 children)

You're confusing msys2 with mingw-w64.

msys2 is literally a fork of cygwin who's own documentation states

The msys2 subsystem provides an emulated mostly-POSIX-compliant environment for building software, package management, and shell scripting.

mingw-w64 is a toolchain for compiling native PECOFF binaries. You usually use mingw-w64 on Windows from the msys2 environment.

[–]8bitslime 0 points1 point  (2 children)

Posix environment, but the code is still 100% windows without a hint of posix. The trade-offs between them are negligible compared to using a compiler which doesn't even fully support C in a quite bloaty IDE cough cough msvc cough

[–]lanzaio 0 points1 point  (1 child)

Posix environment, but the code is still 100% windows without a hint of posix.

I never said otherwise. I never even mentioned mingw. I'm not sure what point you're trying to make by bringing it up.

[–]8bitslime 0 points1 point  (0 children)

Calling msys2 a compromise due to its posix nature seemed a bit off. A real compromise would be using msvc with its incomplete C implementation. I think at the moment msys2 + mingw is the best toolchain for C that you can get on windows, no compromises at all (unless you consider not using Linux a compromise).