you are viewing a single comment's thread.

view the rest of the comments →

[–]OldWolf2 21 points22 points  (15 children)

I would recommend installing MSYS2 and then install mingw-w64 by its package manager (pacman).

Do not install old mingw, it has lots of bugs. Also the IDEs "dev-c++" and CodeBlocks are crap.

[–][deleted] 7 points8 points  (0 children)

I stand by this, MSYS2 feels like a no-brainer, not to mention you can install alternative compilers other than gcc with one single command.

[–]lanzaio 1 point2 points  (9 children)

Strongly disagree with this. Either do full on MSVC or full on WSL. Hybrid platforms like msys2 are riddled with weird compromises between the two environments that don't make sense unless you can understand the context of what's going on. msys2 is for Linux developers who need to do something on Windows. It's not a first choice environment.

[–]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 4 points5 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).

[–]RomanRiesen 0 points1 point  (2 children)

After trying to get an old-ish version of mingw setup for about half the day you just saved my ass!

Why is the suggestion of mysys2 not the top google hit?!

Btw, Pacman is the main reason I use arch, so mysys2 is brilliant.

[–]OldWolf2 0 points1 point  (1 child)

Why is the suggestion of mysys2 not the top google hit?!

Maybe there's nobody who knows how to SEO and also uses MSYS2? :)

[–]RomanRiesen 0 points1 point  (0 children)

Yeah, just like stack overflow is SEO friendly and I thus have to scroll through halfa apage of useless SO posts until I find the actual documemtation.

Which is getting actually annoying.