Skip to content

Commit 7dd8241

Browse files
committed
MB-41209: Use specific 'Winsock2.h' header for timeval
When compiling under MSVC with 'WIN32_LEAN_AND_MEAN' defined (to avoid symbol collisions with glog / reduce number of unnecessary headers included), forestdb fails to compile with the following error: ..\forestdb\utils\gettimeofday_vs.cc(25): error C2027: use of undefined type 'timeval' forestdb\utils\gettimeofday_vs.h(17): note: see declaration of 'timeval' The issue is that gettimeofday_vs.h & time_utils.h includes Windows.h, which will only include the necessary header for 'timeval' (Winsock2.h) if WIN32_LEAN_AND_MEAN is not defined. Fix this by simply including the necessary Winsock2.h header directly. Change-Id: I01338d47b2943e3646e959f19bf6118428ce0e4d Reviewed-on: http://review.couchbase.org/c/forestdb/+/135517 Well-Formed: Build Bot <[email protected]> Reviewed-by: Trond Norbye <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 5836cfc commit 7dd8241

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

utils/gettimeofday_vs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define _JSAHN_GETTIMEOFDAY_VS
33

44
#include <time.h>
5-
#include <Windows.h>
5+
#include <Winsock2.h> // for timeval
66

77
#ifdef __cplusplus
88
extern "C" {

utils/time_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <time.h>
2222
#if defined(WIN32) || defined(_WIN32)
23-
#include <Windows.h>
23+
#include <Winsock2.h> // for timeval
2424
#else
2525
#include <sys/time.h>
2626
#include <unistd.h>

0 commit comments

Comments
 (0)