3 ms·
Here we go: a thread on developing for Windows, and immediately there are several top-level comments saying 'don't'. I suppose you guys like leaving 75% of a po
by delta_p_delta_x 2y ago
Here we go: a thread on developing for Windows, and immediately there are several top-level comments saying 'don't'. I suppose you guys like leaving 75% of a potential install base out of consideration. More money for us Windows devs, I guess.
After having recently worked on a project at work that involved precisely this (migrating a Linux/macOS-first project to Windows), I feel like that table at the top is... not the whole story. I also disagree with the author's conclusion: the easiest and most compatible way to develop on Windows is to use Visual Studio 2022, full stop. Download, install the Desktop Development with C++ workload, and start writing code. Can't be easier. It comes with a built-in debugger, profiler, and various build tools like CMake, Ninja (if you don't like MSBuild/NMake), Clang-CL (if you don't like cl.exe), and much more.
My background is a little different to the author: I've been writing on and for Windows most of the time, and I was only introduced to Linux in university. In order of 'closeness to Linux':
- WSL1/2: these are for all intents and purposes Linux VMs (yes, not in the case of WSL1, but practically it might as well be). Use these as though you would a real Linux machine.
- Cygwin: in general, never use Cygwin for new projects. Cygwin means saddling your user with an entire Linux filesystem hierarchy per application, including stuff like `/bin`, `/etc`, `/lib`, and so on. Additionally, it pretends to support `fork()` on Windows. Windows and NT don't have fork(). Never had, and never will. Don't use it, full stop.
- MinGW: this targets the Itanium C++ ABI. An admirable but sadly incomplete effort. New Win32 APIs like cfapi.h[1] aren't available. Big Windows-specific libraries like Microsoft's WIL[2] cannot compile on MinGW because they rely on MSVC-specific extensions. Deal-breaker for me.
- MSVC providing cl.exe, and also LLVM's official Clang releases for Windows: best options. These target the MSVC C++ ABI and expect/provide a complete install of the Windows SDK and MSVC C and C++ runtimes.
In general, I dislike shoehorning Linux/UNIX onto Windows and vice versa.
System developers should recognise the differences between OS and platform-specific primitives, APIs, and interfaces, and abstract over them depending on their needs. Each implementation should live on its own and should be linked to by the build system, and not directly interspersed in code. This means no `#ifdef _WIN32 #elifdef DARWIN #elifdef __linux`.
Or—and a hot take incoming—if you don't want to do any of this, use a platform-independent managed/interpreted language like Java, C#, Go, or Python.
[1]: https://learn.microsoft.com/en-us/windows/win32/api/cfapi/ https://learn.microsoft.com/en-us/windows/win32/api/cfapi/
[2]: https://github.com/microsoft/wil/issues/117 https://github.com/microsoft/wil/issues/117
- numbsafari 2y ago> use a platform-independent managed/interpreted language like Java, C#, Go, or Python or .net!
- HideousKojima 2y agoI know that F# and VB technically exist, but C# already covers 99% of what people think of when they say .NET
- numbsafari 2y agoZoinks... My brain read that as C++, not C#. Or was I just hallucinating?
- HideousKojima 2y agoAll good haha