]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Fix build for MSVC (#1078)
authorFlorin T <florint@gmail.com>
Tue, 7 Jun 2022 09:06:12 +0000 (02:06 -0700)
committerGitHub <noreply@github.com>
Tue, 7 Jun 2022 09:06:12 +0000 (11:06 +0200)
For Windows the order of the includes is important in wincompat.hpp.

src/core/wincompat.hpp

index e550593cb511189c7e2cbfbcbac86de8d3c05bf6..20827109f4b75dce67d59c51194a2ad21e9ab2fc 100644 (file)
@@ -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>