diff --git a/README.md b/README.md
index 9f65c16290f591e7857d9888138261ab2a885e66..180d2d43138a338cd4e35d982e306871e5d21904 100644
--- a/README.md
+++ b/README.md
@@ -60,6 +60,26 @@ I hope most of the code is portable c++11. But I may have used some c++14
 features. (If this is a problem for you, please let me know.)
 
 
+### Windows
+
+David Huistra tried to build the tool on Windows using MinGW. That did not
+work. (Dynamic linker errors, probably because I am using c++11.) But it does
+work with Visual Studio 2015. For this, you can instruct `cmake` to generate
+a solution file:
+
+```
+mkdir build
+cd build
+cmake -G "Visual Studio 14" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
+```
+
+See [here](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
+for other versions of Visual Studio (not tested). After `cmake` you can open
+the solution file and build the project. NOTE: The `Debug` build does not work
+properly (I will have to look into this), so I recommend building the
+`RelWithDebInfo` configuration.
+
+
 ## Java
 
 For now the java code, which acts as a bridge between LearnLib and this c++
diff --git a/lib/windows_getopt.h b/lib/windows_getopt.h
new file mode 100644
index 0000000000000000000000000000000000000000..e038a1cb9ed24cc09a966a9244ad3b4146684a9c
--- /dev/null
+++ b/lib/windows_getopt.h
@@ -0,0 +1,74 @@
+#pragma once
+
+#include <string.h>
+#include <stdio.h>
+
+int     opterr = 1,             /* if error message should be printed */
+  optind = 1,             /* index into parent argv vector */
+  optopt,                 /* character checked for validity */
+  optreset;               /* reset getopt */
+char    *optarg;                /* argument associated with option */
+
+#define BADCH   (int)'?'
+#define BADARG  (int)':'
+#define EMSG    ""
+
+/*
+* getopt --
+*      Parse argc/argv argument vector.
+*/
+int
+  getopt(int nargc, char * const nargv[], const char *ostr)
+{
+  static char *place = EMSG;              /* option letter processing */
+  const char *oli;                        /* option letter list index */
+
+  if (optreset || !*place) {              /* update scanning pointer */
+    optreset = 0;
+    if (optind >= nargc || *(place = nargv[optind]) != '-') {
+      place = EMSG;
+      return (-1);
+    }
+    if (place[1] && *++place == '-') {      /* found "--" */
+      ++optind;
+      place = EMSG;
+      return (-1);
+    }
+  }                                       /* option letter okay? */
+  if ((optopt = (int)*place++) == (int)':' ||
+    !(oli = strchr(ostr, optopt))) {
+      /*
+      * if the user didn't specify '-' as an option,
+      * assume it means -1.
+      */
+      if (optopt == (int)'-')
+        return (-1);
+      if (!*place)
+        ++optind;
+      if (opterr && *ostr != ':')
+        (void)printf("illegal option -- %c\n", optopt);
+      return (BADCH);
+  }
+  if (*++oli != ':') {                    /* don't need argument */
+    optarg = NULL;
+    if (!*place)
+      ++optind;
+  }
+  else {                                  /* need an argument */
+    if (*place)                     /* no white space */
+      optarg = place;
+    else if (nargc <= ++optind) {   /* no arg */
+      place = EMSG;
+      if (*ostr == ':')
+        return (BADARG);
+      if (opterr)
+        (void)printf("option requires an argument -- %c\n", optopt);
+      return (BADCH);
+    }
+    else                            /* white space */
+      optarg = nargv[optind];
+    place = EMSG;
+    ++optind;
+  }
+  return (optopt);                        /* dump back option letter */
+}
diff --git a/src/main.cpp b/src/main.cpp
index 367d1fc60f62808ea6bce987ebea2058e330aff3..75e67e16e1a73e99c2a183ccccca8e3ceb591d7e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,7 +24,13 @@
  * I've installed this software several times, and it was never
  * easy because of its dependencies.
  */
+#ifdef _WIN32
+extern "C" {
+#include <windows_getopt.h>
+}
+#else
 #include <unistd.h>
+#endif
 
 using namespace std;
 
diff --git a/src/trie_test.cpp b/src/trie_test.cpp
index fd18ea514d1a8023a6dc9f8c4309174ae74d81cb..fb15bbe318949c953fab48c4c841e79c2e8006d1 100644
--- a/src/trie_test.cpp
+++ b/src/trie_test.cpp
@@ -3,6 +3,7 @@
 #include <algorithm>
 #include <chrono>
 #include <iostream>
+#include <numeric>
 #include <random>
 #include <set>
 #include <stdexcept>