Hacker News new | past | comments | ask | show | jobs | submit login
How to develop on Windows: comparing native, MinGW, Cygwin, WSL (tmewett.com)
49 points by thunderbong 6 months ago | hide | past | favorite | 88 comments



Nitpick, the article’s suggestion that Git badly supports Windows strikes me as about 2 decades out of date. I dev on native Windows (only using WSL for key tools like sl and cowsay) and Git has Just Worked pretty much ever since I began using it.

Maybe the only speedbump is that you gotta remember to turn off the “autocrlf” setting, which has a default from way back when there were still editors on Windows that choked on \n.


Windows can't handle symlinks in a sane way because they're a source of privilege escalation exploits on Windows. So git repos with symlinks in the require a security degradation to use them natively.

Performance also still sucks, although the VFS stuff in the Microsoft fork kinda helps I guess.


Having only recently dropped Windows as my OS of choice for professional matters, I can get behind this statement. On rare occasions, the line ending stuff got weird. Other than that, it was smooth sailing.


> a lot of tools are made primarily for Linux. Surprisingly this even includes very popular ones like Git

A bit off-topic but this particular example becomes less surprising if you look up who created git :)


Not only who create git, but why specifically they created git.


How to make people who were there to witness it and migrated projects from subversion before GitHub was a thing feel old. Twas only yesterday dammit


Imagine how old you feel when you remember Subversion being the new thing replacing CVS…


Or moving from RCS to CVS.


But why did they create it?

Linux (UNIX) is an engineering OS. Windows is a slap dash Product chaotically rushed out and now buried under several layers of fad-strata that was meant to help moms store recipes on their kitchen PC. This is directly reflected in the development experience and culture.


This is wrong on so many levels. Linux started out as a hobby project. In contrast, Windows NT started out as a well designed system made by seasoned professionals.


... Linux was a hobby project copying UNIX. And Windows NT's "good design and professional pedigree" must be subtle because Windows is a hot, disorganized mess that's hell to use or develop in.


Well Linux needs Docker containers to make deployment and dependency handling manageable, so I’m not too sure which one is the hotter mess.


> Developing on Windows can be frustrating

As a primarily Windows developer of video games I find developing on Linux far more frustrating, fragile, and error prone than Windows.

However it's less about which is better or worse, and more about the devil you know. Setting up a brand new macOS for development is excruciating. Learning Linux is an extremely long, time consuming, and painful experience. But once you've built up some scar tissue it doesn't seem so bad!

> The cleanest way is to just use Linux on Windows

Hard hard hard disagree. I could not possibly disagree more strongly. I violently and disrespectfully disagree.

> The other option is to use Windows proper

This is the way. Don't use Cygwin or MinGW-64. That is bad advice.

I write a lot of C++ code. It typically needs to run on Windows, macOS, Linux, and Android. My experience is that Windows developers are generally content to step out of their comfort zone and work on macOS and Linux "natively". My personal lived experience is that Linux-first developers are far and away the least likely to even think of Windows or other platforms. They frequently refuse to request a Windows machine so they can even test another platform. Which means I have to fix all their broken code, grumble grumble. If you hard coded /usr/lib or similar you're a bad person.

My recommendation is to simply learn Windows and do things the native Windows way. Stop assuming all platforms are Linux. Cross-platform is a solved and relatively simple problem. Trying to force everything to behave The Linux Way is pain and suffering.

Personally I think "The Linux Way" is generally quite bad. Try something different! Be open to new experiences! Don't dip your toes in the water, jump in the deep end! You might learn a thing or two. And who knows, you may even discover it's quite pleasant.


Having done multi system projects you are spot on. Even those libs that cover over some of the differences tend to have a lot of interesting edge cases. For example threading will act one way on windows and a subtly different way on linux if you happen to use one of the popular threading libs. Even the CRT can have different cases for something simple like 'printf' (always re-read the docs for your compiler and platform before you port). So you end up with this weird glue abstraction layer anyway and quickly end up with config files for your paths.


In my experience doing systems programming across Windows, macOS, and Linux, there are a few specific areas where developing on Windows is the best platform. Game development is one of them: DirectX 12 is the industry standard graphics API, and the first- and third-party tooling related to it is cream of the crop on Windows.

.NET development is another area where Windows shines. And if you're comfortable living in Visual Studio and not really venturing into the CLI world, I can see Windows development being very nice. VS is truly the premier IDE.

With that said, for most other types of development, Windows is unergonomic or an outright PITA compared to Linux and macOS. Web development, data science, embedded, scientific computing, general scripting, and anything related to CLI tooling and development. This isn't a secret either: it's why WSL was launched to such acclaim from developers.


Hard disagree on Visual Studio being a "premier" IDE, I know VS2022 cleaned up a lot from VS2019 but it still is one of the slowest IDEs I have ever used and the intellisense will just sometimes break through multiple windows restarts. One of my biggest tips to my classmates in uni has been to just use literally anything else from VS Code (which admittedly isn't much better but doesn't take nearly as long to start up) to the Jetbrains IDEs which are thankfully free for students.

EDIT: On second reading I see you meant specifically for C# where omnisharp in VS Code really leaves a lot to be desired but Rider is still at the very least a good peer if not straight up better and faster than Visual Studio


Tell me you have never used Xcode without telling me you have never used Xcode.


I think for Gamedev windows is mostly good just because that's where most of your players are.

Tooling was historically also better from a GUI perspective. With nicer to-use debuggers. Now on Linux you can use Jetbrains products if you need them.

Vulkan is just as much an industry standard as DirectX 12 is. I did a lot of work with both. Choosing between them is often just a matter of being already used to one when it comes to PC support. You'll have to do DX for Xbox support and that's sometimes a bigger player base for you than Android/Linux/Switch/Mac(MoltenVK), though.

As a game developer, I can see how DX12 got a lead. As a Linux user, I'm a bit salty that it's being chosen so often! As we could have all united on an open multiplatform API :(


> Web development, data science, embedded, scientific computing, general scripting

I don't follow this list. The large majority of both front-end and back-end web dev is almost entirely JavaScript, which completely abstracts the OS away and runs in a managed environment, mostly Chromium. This has first-class support on Windows anyway. What about writing CSS requires Linux? Web back-ends are usually written in one of JS, Python, C#, or Java, and all are platform-independent managed/interpreted languages.

Data science and scientific computing tend to be written in Python, especially considering ML/AI libraries, and Python works well on Windows.

As for general scripting, bash is a poor example. Python is again natively available, and better still, there is PowerShell, with straightforward access to the entire .NET/.NET Core libraries. I can absolutely write superb CLI interfaces in PowerShell (or even in C#, and then expose CLI interfaces in PowerShell). I don't see how Linux is in any regard superior.


I did both web development and deep learning on Windows proper, and can't quite understand what you mean by unergonomic.

Can you name specific examples?

I sort of have opposite experience with Linux where installing the right version of CUDA and GPU drivers was a quest (~5 years ago).

Same with conda for Python and npm for web.


As soon as you have to create clusters and do not use a single machine, or use network drives/windows fs for data at rest in a usable way (not slow as hell), or do anything with the network that also has to be sightly secure, you really have to be an expert to do anything (securely). Windows Sec/Ops are probably the software engineers I respect the most.


What you're developing makes a big difference. If you're making games and writing C++ in UE, or used to working with blueprints, or developing for graphics, then trying to do the same in Linux will be a horrible experience. This is why people don't tend to use Linux to write games. However, if you're developing for the cloud or writing applications or anything involving servers and scale (arguably the majority of software being developed today), then the exact opposite is true.

I think the reason that this post exists is that, sadly, software devs don't always get to choose their OS. Many (lazy, old-fashioned) organisations with huge managed fleets of CrowdStrike-infected Windows laptops still insist on shipping the same machines to their software teams as they do to their salespeople, forcing the former to figure out how to get stuff built while effectively working in shackles. I think that's who this post is targeted at and the problem it tries to solve.

I disagree with you that cross-platform is a solved and relatively simple problem. That may be the case for UIs/desktop apps/games, but it certainly isn't for cloud-relevant software.

I 'violently and disrespectfully disagree' that somehow developers are trying to 'force everything to behave The Linux Way'. The software that powers the modern world and that we end up talking about on here most of the time, simply doesn't run on Windows, it runs on Linux. Windows may be a very popular desktop OS, but it is also a huge steaming pile of candy-crushed turd, and I don't think 'simply learning Windows and doing things the native Windows way' is advice I would ever give anyone, ever.

_Unless_ you're a game dev.

On that point, I do think this post is titled badly, and suffers a bit from the HN bias that 'development' always means clouds and data and scale. Maybe a better title, something like 'coercing Windows into building software that it isn't itself capable of running in production' would have saved you a few clicks.


If you don’t need to run/build on Windows, then don’t use Windows!

But if you do need run/build on Windows it’s much better to do things The Windows Way, imho. Trying to force Windows to behave like Linux is a terrible, terrible idea in my experience.


It depends on what you are making more than anything. If you're writing services that will be deployed on Linux servers (to save cost, increase availability, etc), then using WSL2 is probably the best bet if you must use Windows.

I've done a fair amount of Windows services development as well as services deployed to Linux. I'll honestly take the Linux way, in particular Docker/containers as a target. It works when you build, works when you deploy, no surprises, no separately installing a dozen dependencies that blow each other up, like in Windows a lot of times.


Nah. Debuggers on Windows proper are much better experience than Linux (especially C/C++ and .NET), so when I was at Amazon I would always have a short stub for any project (mostly Java) that launches it directly on my host Windows machine so I could use the debugger, and didn't have to wait 2+ minutes to launch the changes.


It's shocking how many Linux programmers rely solely on printf debugging. My goodness it's like programming in the stone age. printf is the ultimate fallback, not the tool of first resort!


Have you tried Rider for C# on Linux (or MacOS)... works pretty well, I know those who prefer it to VS.


Even used rr?


Visual Studio proper has time-travel debugging (IntelliTrace) with GUI since VS 2010. RR came out in 2016.


Well, not bad for RR then, it's 2024.


Does it have a descent GUI yet?


My unpopular opinion is that Docker exists because Linux is so extremely unreliable that the only way to deploy a program that can even launch requires create massive Docker images. The Linux model of "global dependencies in a few shared system folders" is, imho, a failed model.

> If you're writing services that will be deployed on Linux servers

Yeah I just use Linux for that.

I wish all programming languages allowed you to trivially cross-compile. This is something that Zig does very well. Rust kinda sorta supports it, but it's a hacky painful broken mess. C++ doesn't have a standard build system so it's just lolbad.

glibc is a total disaster. It's stuck in bad design from the 80s. Zig largely solves it and lets you trivially target any ancient version of glibc. The hoops they jump through for Linux cross-compile support is an order of magnitude more complex than macOS and Windows.


Go seems to do a lot of what you're looking for, including run on minimal containers. Rust can be close to that, but it's more low-level flexible, so depends on your approach and target.

There are thinks I do like about Windows... that said, I've seen far too many problems trying to upgrade software on Windows Server(s) to ever choose it again.


> Stop assuming all platforms are Linux

We've gotten to the point where outside of some consumer-facing niches like gaming, or industries with vendor locked-in tooling, it's largely true that it's all Linux


despite being an extremist fan of free software, i pretty much agree with you. i ported patch(1) to cygwin back in the 90s (though i never did try to get my changes merged into the mainline)

the native windows way is often even worse than the linux way, but sometimes it's actually better and it's too bad linux doesn't do some things the windows way. exhibit a: the x11 protocol

what do you think of .net core? because as far as i know that's the only native-code-generating compiler for windows other than mingw-64 (and proprietary compilers)


> what do you think of .net core?

Not the parent commenter, but... This is not relevant; .NET Core is a managed environment. If your needs dictate it, then it's a very good choice.

> that's the only native-code-generating compiler for windows other than mingw-64 (and proprietary compilers)

clang also generates native Windows code. You can even set clang to automatically target Windows and expect the Windows SDK by running `clang-cl`. You of course will need a Windows SDK and MSVC C/C++ runtime mounted on a case-insensitive filesystem, like the Firefox guys have done[1].

[1]: https://glandium.org/blog/?p=4020


i don't think the msvc c/c++ runtime is open-source, is it?

(the native-code bit is just the cil jit compiler i think)


It is managed, but it also lets you write C-equivalent code with a similar degree of freedom, and compile it to native executables.


I agree with your general sentiment that leaning into the platform and away from compatibility layers is a good strategy. There are reasons these things are differently and compatibility layers by you little and cost a dependency.

I think we disagree on some details. I don't think windows is a serious server OS, and never has been. Look at the crowdstrike failure, solar winds leak, or the yearly issues that are biting millions of people and there is no sane way to avoid. So I am just surprised when you said:

> fragile, and error prone than Windows.

Are we living in the same universe?! Crowdstrike aside, every windows shop I have worked at, including EA and the USAF, had massive and constant CI failures if they could get CI working at all. Often they had teams of dozens working on remediating this stuff perpetually. These places also have infrastructure go down for the dumbest of reasons, like unscheduled updates or impossible version mismatches.

The Linux shops generally had predictable,repeatable, and knowable causes for failures. Places like TD Ameritrade and Nationwide Insurance go down because they screw up.

It isn't always like that, but the Unix/Linux shops I have worked at measure yearly downtime in seconds and windows shops measure uptime as a percentage.

> If you hard coded /usr/lib or similar you're a bad person.

1000% agree, but I also see plenty of hardcoded "c:\\" in code also written by bad people. I also find the amount of people who claim that "include "windows.h"" is always valid C++ is infuriating, like other platforms don't exist. The people including "dirent.h" (Unix DIRectory ENTries) are so common that the MSVC saw fit to implement it some time about VC6 and VC2022.

Writing cross platform code isn't that hard if you just test. 99% of the time it works to just write a wrapper around the platform call to do a thing and call that wrapper.


> I don't think windows is a serious server OS, and never has been.

This is a very silly statement.

I hope you realize that Crowdstrike also runs on Linux and has also broken Linux machines. https://access.redhat.com/solutions/7068083

I don't know why your companies had issues with Windows CI. If I had to guess I'd say because it was Linux shop with people who refused to learn Windows, ha! Everywhere I've worked had perfectly stable Windows CI.


And unscheduled updates and reboots is the IT department failing to do their job. Last Windows shop I worked at, every single update and system restart was scheduled days if not weeks in advance and the systems mostly only went down unexpectedly when hardware was failing, which is pretty OS-agnostic.

Of course, if you just have a few fly-by-night Windows systems that aren't centrally managed, you're going to have issues.


> And unscheduled updates and reboots is the IT department failing to do their job.

Why do I keep seeing this at windows shops and not Linux shops? Maybe it is just selection bias, I have only had 16 contracts in the past 20 years not quite a statistical level sampling yet. But I would seriously like to explore non-selection bias reasons why this IT departments seem to fail like so often using windows and not as often or at least not as publicly otherwise.


I think it depends. In my experience, this tended to be more of a problem in places that had mixed systems, or allowed people to BYOD. Every place that was running windows exclusively tended to have a halfway reasonable AD setup and at least someone in IT who was intimately familiar with administrating a fleet of Windows machines.


On the failing CI, I suspect it was more a culture thing than a specific technical detail thing. Windows shops often try to purchase solutions to their own organization's failures, like the crowdstrike thing (Yeah I know some Linux machine were impacted but it was like a thousand to one).

There is a non-zero amount of technical failures, but not enough to explain the vast disparity I have witnessed and keep witnessing.


> My personal lived experience is that Linux-first developers are far and away the least likely to even think of Windows or other platforms.

I mean, it doesn't help that until 2019, the choice was unambiguously between "do it according to international standards and useful features" and "do it according to the Microsoft way and annoying bugs".

(support for Apple, by contrast, is largely a matter of whether you can afford the extortion fees)


What international standards are you referring to?


These little things called the "C standard" and "C++ standard".


The author's recommendation of a MinGW-W64 toolchain + Cygwin build utilities is the workflow I followed for several years before moving to MSYS2, before ditching Windows entirely a few months ago.

WSL did its job quite well, but asking a user to set up WSL is out of the question. It isn't well-suited for anything a non-technical person might want to touch.

One thing the author doesn't make clear is that MinGW-64 does not fully implement a Linux compatibility layer. For example, if you try to use MinGW to compile a program that calls fork(), you're going to have a bad time.

That's why Cygwin is still relevant today - its compatibility layer is much more comprehensive than MinGW, at the cost of an extra DLL that has to follow your program around. Also bear in mind that Cygwin has to do some really nasty things [1] to do everything it does. Whenever you run into a situation where the Unix API doesn't align with the Windows view of the universe, Cygwin runs the risk of introducing severe performance issues.

[1] https://cygwin.com/cygwin-ug-net/highlights.html


A great summary that should encourage more Linux developers to use Windows. Lots of utility with WSL2 and Hyper-V built in, you can run any Linux distro you like with a single click from the MS Store, while enjoying the great performance and UX on Windows 11 (once you turn off the ads -- yeah I know).

I use a combination of VS Code with WSL2 Debian -- so it's identical to my prod environment. It's polished, consistent with prod and efficient on my hardware.

Compared to the Mac I find the Windows experience to be far better, because of the native Hyper-V VM support, better Linux compatibility with WSL2 and the much more diverse hardware options. The PC ecosystem is incredible.

Even the Windows ecosystem is nice, Visual Studio Community is free, the CLI compiler is available, winget makes installs easier, Powershell has a lot of utility and Windows Terminal is excellent.

Given that you can pick up a capable mini PC for about $200 , it's worth testing out. Windows is great for Linux development.


I've been developing on Windows the last year and a half. I came from a Linux background and wanted to learn how to use Windows in the same way I used Linux, that is to say, I wanted to avoid finding "bash on Windows" solutions and calling it a day.

My advice, install Visual Studio (or just the build tools), fire up the developer command prompt for your architecture, then learn the cl (compiler) and ml (the assembler) command line invocations. Many common Unix commands have an equivalent command prompt command you can learn. It just takes some repetition to remember them.

I will be the first to admit, it's very funky. Copy and move have some quirks (use xcopy or robocopy). Batch scripts execute in a really uninituitive way. There are a lot of rough edges but you can develop C and C++ like you would on Linux with a terminal and text editor, it just takes some getting used to.


My go to on Windows is LLVM using the Windows SDK for libc. Before Microsoft had solved the whole msvcrt redistributable mess I used mingw-64 as the libc which worked pretty well actually.


This article doesn't quite land for me. It could perhaps use an introductory paragraph explaining who it's for / what the goal is. For example, are we trying to build cross-platform software, with a single build system?

> If you want to develop C or C++ on Windows, your options get more complicated.

This is a weird thing to say. If you want to build software for Windows -- especially so in C or C++! -- your choice is simplified. The best way to build software for Windows is to use Windows tooling. MSVC is excellent at compiling standard portable C and C++ code to a native windows executable. If you write portable code, it will compile with any of the major compiler suites, for any of the platforms they (fully) support.


If you just want basic Linux utilities, create a Windows terminal profile pointing to C:\Program Files\Git\bash.exe.

You likely have git installed anyway and this works very well. I use this all the time.


but it's... so... slow....

I use windows only bc I have no choice at work. the DX is painful.


If it's a work machine, you probably have network drives. Git bash is incredibly slow when working with network drives.


I'm talking about local filesystem. Things like reflecting git status in $PS1 take many hundreds of milliseconds...


bash is slow? Maybe, but I've never noticed a problem. I have opened huge files in vim as well.


The bash in MinGW-64, or whatever it's called that comes with git for Windows. Which doesn't come with vim, IIRC, so that can't have been what you're talking about, right?


Cygwin is currently the bane of my existence.

I'm working on software, that was originally written in CORAL and running on mainframes and then translated to C to run on UNIX.

Company policy is, that all programs have to run on Windows, so nowadays we work with Cygwin Don't get me wrong, it works, but there a thousand annoying things, bugs an inconveniences.

I'm currently spearheading an effort to migrate to wsl2 (and docker). The developer experience is vastly better on wsl.


+1

After falling out of love with macOS a couple decades ago, I've been using WSL/VMs on Win{7|10|11}. While I sort of detest the ads on my corporate Win11 laptop, it's what the corporation requires I use. VirtualBox on Win7 was a very usable solution. WSL1 on Win10 was a tiny bit rough, but WSL2 on Win10/11 has been pretty decent. The only problem I have is it's unclear who "owns" mDNS: windows side or leenucks side. For most of the last several years it just plain didn't work on the leenucks side. Then a work-around was published, but it seems to not work now.

But... I love small charts like this. I hadn't been thinking about cygwin or MinGW. It's good to be reminded they still exist.


The only issues I have when developing natively on Windows are when other developers on macOS don't use cross-platform tools (bash scripts). Scoop is a great package manager, and with windows-terminal + powershell you can't really ask for anything better.


I wonder, What’s the key features that make scoop better than winget.

(I use winget as it seems to be now available out of the box)


For me: winget still is missing critical tools that I need, most notably maven. I've also found scoop extremely easy to contribute too. I also don't need to worry about it pulling packages from the windows store or running installers that won't install to my user directory.


Something about synchronicity, serendipia, Jung, David F.Peat... must be true, because I've been trying to compile stuff with mingw for days and then it's not odd to see that either at HN, Reddit or the Spanish Digg/Reddit clone.

Jokes being put aside, I've got to cross-compile Kristall for MinGW (Windows 32 bit target, for W7), but it required tons of deps and it the end it gave me errros on some libs, so I will rebuild it statically with the full src in a parallel tgz. At least it launched with an error under Wine (dynamic binary), so I can say mingw32 works fine.

I tried to the same with Lagrange, but it gave me an error on libUnistring. As the $DISTRO I use didn't provide it as a MinGW package, I gave up.


Just download the latest visual studio, no need for gimmicks or trying to reproduce the unix dev experience on windows, just embrace the platform, warts and all, and call it a day.


If you are going to develop on Windows and you aren't developing for Windows, you are what the construction and film production industries call "green".


I don’t like this article as it seems the author did not dive a bit into some of the topics he mentions. As an example I wanna point out WSL2 and USB support:

https://github.com/dorssel/usbipd-win

This is the recommended way and works as expected. It is also possible to directly mount WSL2 drives with near native performance.


I had a lot of fun using MSYS2 / MinGW64 and building things for Windows, but I can't imagine it being fun for most people.

Installing git-for-windows was an easy way to try it out, to see if that rabbit hole is for you.


MSYS2 plus its CLANG64 environment is great stuff:

https://www.msys2.org/docs/environments/


Honestly, Qt C++ & QML is the best way to develop on Windows (and Linux). Soon enough, I'll also prove it's the best for macOS (under some specific expectations).


QT5 has great support under MInGW even by crosscompiling it from GNU/Linux to Windows.


I've been using MinGW and MSYS for Windows development since the early 2000's, mainly to keep the build process consistent with Linux. A couple of years ago I gave Visual Studio / MSVC a second chance and have stuck with it ever since.

MSVC generates significantly faster & smaller code, doesn't require additional DLLs in the final build, and the C++ compiler behaves predictably. Critically it also works very well with CMake, so my build process is seamlessly aligned with Linux.

The VS debugger is a major help too - gdb can do the same stuff, and there are UIs for gdb, but debugging through VS is just more productive and convenient. Times change!


I think this headline should read specific to C/C++ for Linux.

I'm still not sure that I agree with the above, but I do know for sure I couldn't say this about Python, Java, Go, web, etc. because development on Windows for any of these most popular languages is braindead simple in those cases. In fact it's much easier than setting up in Linux or Mac for the same thing. Especially in a multi platform enterprise environment with lots of security controls and a need for cross platform file sharing.

To put this in perspective, this article is a tour of trying to do cross platform development in C/C++ on the only desktop OS that it's reasonable to do that in at all.


> this article is a tour of trying to do cross platform development in C/C++ on the only desktop OS that it's reasonable to do that in at all.

This is a superbly succinct take of Windows.


Everytime I read articles like this no one brings up that wsl caches file transfers in RAM. With large enough transfers it slows your machine to a halt. It's infuriating and made me switch to Linux for heavy workloads.


The better name of the article would be "What to do if you only developed in Linux and now need to develop under Windows but are too lazy to learn the tools and best practices within Windows ecosystem". There's also much simpler way - spin up a VM with Linux and continue developing there.

Or you can, you know, learn to develop with Visual Studio, Azure, and entire development ecosystem built by MSFT in the last few decades.

And btw Git might have been built by Torvalds but GitHub is owned by Microsoft :)


> And btw Git might have been built by Torvalds but GitHub is owned by Microsoft :)

Yeah. That's why you should use one, but not the other.


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/

[2]: https://github.com/microsoft/wil/issues/117


> use a platform-independent managed/interpreted language like Java, C#, Go, or Python

or .net!


I know that F# and VB technically exist, but C# already covers 99% of what people think of when they say .NET


Zoinks... My brain read that as C++, not C#. Or was I just hallucinating?


All good haha


Switch to Linux


> The cleanest way is to just use Linux on Windows, via a full VM, or through WSL2, which is a lightweight, well-integrated VM.

The cleanest way is to get a job that doesn't require you to develop on Microsoft Windows.

Then you can just use Debian Stable, or some other decent Linux distro.


True, but at most corporate firms or regulated industries you often have no choice. Good luck trying to get on the corp network in a dual booted system that doesn’t have their usual spyware/corp suite of shit ware and of course ClownStrike Falcon crap.


> at most corporate firms

Some time around mid-2012, at two different higher end of software development firms, the target system for 90+% of clients was some open source language such as Java, Node, Python, Scala, Ruby, targeting some Linux. At one of these our DevOps went ahead without even really being asked to at least monitor that our builds ran successfully on BSD and illumos, and occasionally patch as necessary.

For clients asking us to work on .NET there was a premium charge and ZeroMQ was used to "bridge" .NET with something else. The only clients that successfully insisted on pure .NET did so by paying a bigger premium charge.

By 2018, we were doing heavy sideways discounts on ".NET core for Linux" in the form of heavy premium charges for the alternative.

> Good luck trying to get on the corp network [with] ClownStrike Falcon crap.

This is what a virtual machine is for.


What is your current policy regarding .NET?


In these places we wouldn't call it a "policy" but just how we did things.

One of the devs there was talking to someone about "implementing any calls in .NET" as NetMQ (native ZeroMQ for .NET) using an exclusive pair socket to pass Apache Thrift back and forth to Rust codebase also using the exclusive pair socket. One of the phrases I heard was "all code we contribute is accessible to your existing .NET devs".

The term accessible may not mean readable or maintainable for the .NET devs in that context, but the corporate customers seemed comfortably confident they would continue to have a relationship with the firm so whatever.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: