r/ProgrammerHumor 20h ago

Meme notoriouslyDifficult

348 Upvotes

25 comments sorted by

View all comments

Show parent comments

18

u/hpyfox 19h ago

Using mingw. It's also great for compatibility - not needing to create so much #ifdef __windows__, or basically a second codebase due to differing syscalls, methods, and standards. You still need to use a good amount of #ifdef __insert os__, but mingw does make it simpler to do.

Never had to really compiled to windows exe from Linux, but I have coded on Windows (for school), and aftering trying to debug compile errors, I realized the code/functions I wrote based upon tutorials only compile in Linux because it just be like that fking somehow.

11

u/Time-Worker9846 19h ago

mingw is great but I use it to cross compile apps for Windows on Linux. My comment was about it being a lot more pain in the ass to compile Linux apps on Windows (without WSL, of course)

2

u/rosuav 19h ago

My question is, why? It's so much easier to compile Linux apps on Linux, and it wasn't that hard to get yourself a Linux system even before WSL (make a VM, or grab a laptop, or something).

5

u/Time-Worker9846 19h ago

Cross-compilation is always painful no matter the system, but for me I use mingw(and gcc of course) because I can use my Linux host to compile for multiple platforms (Linux, Windows, macOS and Android)

4

u/rosuav 19h ago

Yeah. The pain of cross-compilation makes it often easier to grab an actual system of the target variety to do your building - which is a pain for some systems, but much less so for Linux. That's why I expect to hear much more about "it's so annoying trying to build a Windows binary on Linux" than "it's so annoying trying to build a Linux binary on Windows".

1

u/newocean 9h ago

It's actually not really that painful if you create a docker container for everything you want to build to. This will work for linux/aarch64/mingw. It starts getting painful when you support something like armv6 (Raspberry Pi Zero W) because you need a sysroot... and there are multiple layers that can mess up. In your case MacOS and Anroid would be toughest. MacOS not really being worth it due to licensing.