Wednesday, August 3, 2016

Windows really sucks for software development

One thing I have always loved about modern Linux distros is how laughably easy it is to install any program or library available for said distro.

As an example, suppose I want to write some C++ code and want to use gcc (or more precisely g++) to compile it. Suppose it's not already installed in the system. What to do?

Well, it's pretty simple. Just write "apt-get install g++" in a terminal, and that's it (at least in most linux distros; others have similar package managers, eg. zypper.) But maybe it needs a bunch of other programs and libraries that are not installed in the system? You don't need to worry because it automatically checks all these dependencies and will also install anything that g++ needs to work.

But perhaps you don't like writing commands on a terminal, and instead would like a more graphical solution? Again, not a problem, in most distros. For example in OpenSuse you just launch the graphical package manager, write "g++" in its search field, and tick "g++" from the results, and install. It works the same as the command-line version in that it will automatically check dependencies and install everything that's needed (telling you beforehand, if you so desire).

And then it just works. You are ready to compile your C++ program.

And this is the same for almost anything that's available for that Linux distro (and repositories tend to be quite complete.)

But how about Windows? No such luck. There are no software package management systems, there are no repositories, there are no easy ways to install and maintain such packages.

For example, if you would want to use g++ in Windows, you need to find out some Windows port of it, such as mingw, and manually download an installer and run it, jumping through several hoops to do so. (In this particular case the authors have tried to make it as easy as possible, thankfully.)

Then you need to manually add a search path to the mingw binary directory, because there are no standard binary directories in Windows. (In some sense this can be a good thing, especially since Windows is not really a command-line oriented operating system, but in other senses it can be a nuisance, like here.)

Then you go and try to compile your first C++ program using g++... only to find out that no executable is created. For a completely mysterious reason. If you try to compile a C program with gcc, it creates the executable just fine, but if you try a C++ program... nothing. It compiles (and will eg. give proper compiler error messages if there are errors in the source code), but no executable appears. And, of course, Google is of no help whatsoever on this.

Also, you try to compile some C++11 code. g++ itself supports it just fine, but you get a million error messages from the standard libraries which, apparently, have no C++11 support in mingw, or are completely broken in C++11 mode, for reasons only known to the authors.

mingw seems to be completely useless. I just can't get it to work, and not even extensive Googling is helping.

And then people can't understand why so many developers prefer Linux.

2 comments:

  1. For C/C++ that might be true. I'm not aware of any ready-to-use C++ libraries repo for Windows.
    So usually the cases are:
    1. Deal with UNIX-y Makefiles stuffs (build with MinGW/Cygwin) and configure the libs manually
    2. Or built with MSVC (some open source projects generously provide cmake projects/VS projects).


    I've done them. Of course, not as easy as in Linux where you can just install everything by typing a single line in terminal,
    but hey, it's pretty doable. Not exactly a rocket science.
    Then again, I deal mostly with Java, and thanks to maven, I don't need to configure my projects manually.

    Your mileage may vary.

    ReplyDelete
    Replies
    1. I was eventually able to get mingw working by downloading the mingw64 fork, rather than using the original mingw. It seems to be better maintained, and worked out of the box (after manually settings the search path in Windows' settings).

      Delete