[Olsr-dev] [PATCH v1 2/3] win32: only declare struct timespec when needed

Ferry Huberts (spam-protected)
Wed May 30 15:53:42 CEST 2012


From: Ferry Huberts <(spam-protected)>

To make mingw cross compilation on Fedora 17 work.

[CC] src/common/autobuf.c
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/time.h:277:0,
                 from src/defs.h:54,
                 from src/common/autobuf.h:47,
                 from src/common/autobuf.c:42:
/usr/i686-w64-mingw32/sys-root/mingw/include/sys/timeb.h:90:8: error: redefinition of 'struct timespec'
In file included from src/defs.h:46:0,
                 from src/common/autobuf.h:47,
                 from src/common/autobuf.c:42:
./src/win32/sys/time.h:82:8: note: originally defined here

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/win32/sys/time.h |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/win32/sys/time.h b/src/win32/sys/time.h
index 7c41b5c..0a5a3fa 100644
--- a/src/win32/sys/time.h
+++ b/src/win32/sys/time.h
@@ -79,10 +79,14 @@
   while (0)
 
 #if !defined WINCE
+
+#ifndef _TIMESPEC_DEFINED
+#define _TIMESPEC_DEFINED
 struct timespec {
   unsigned int tv_sec;
   unsigned int tv_nsec;
 };
+#endif
 #else
 #include <time.h>
 #endif
-- 
1.7.10.2





More information about the Olsr-dev mailing list