summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorin T <florint@gmail.com>2022-06-07 02:06:12 -0700
committerJoel Rosdahl <joel@rosdahl.net>2022-08-20 13:30:28 +0200
commit5739866ec2ac5137732141e9984e5498f387a39c (patch)
treeac6d6cd771693469a3188a0882798398cb09635b
parentc532b79d60c8f22e4a66d8f93b927f79e88b94dd (diff)
downloadccache-5739866ec2ac5137732141e9984e5498f387a39c.tar.gz
fix: Fix build for MSVC (#1078)
For Windows the order of the includes is important in wincompat.hpp. (cherry picked from commit 375d566635a934ba22287c391f39e58e85aa8567)
-rw-r--r--src/core/wincompat.hpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/wincompat.hpp b/src/core/wincompat.hpp
index e550593c..20827109 100644
--- a/src/core/wincompat.hpp
+++ b/src/core/wincompat.hpp
@@ -75,9 +75,13 @@ const mode_t S_IWUSR = mode_t(_S_IWRITE);
# define NOMINMAX 1
# define WIN32_NO_STATUS
// clang-format off
+# include <winsock2.h> // struct timeval
+// windows must be included after winsock2
+// https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h
# include <windows.h>
+// bccrypt must go after windows.h
+// https://stackoverflow.com/questions/57472787/compile-errors-when-using-c-and-bcrypt-header
# include <bcrypt.h> // NTSTATUS
-# include <winsock2.h> // struct timeval
// clang-format on
# undef WIN32_NO_STATUS
# include <ntstatus.h>