[PATCH] Avoid error: redefinition of typedef ‘bool’

subsurface at henrik.synth.no subsurface at henrik.synth.no
Sun May 5 14:02:17 PDT 2013


From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>

The compiler on MacOSX wouldn't build Subsurface
without ifdefs around the 'bool' typedef.

Signed-off-by: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
---
 display.h  | 3 +++
 divelist.h | 3 +++
 profile.h  | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/display.h b/display.h
index bc60c05..c539475 100644
--- a/display.h
+++ b/display.h
@@ -7,9 +7,12 @@ extern "C" {
 #if __STDC_VERSION__ >= 199901L
 #include <stdbool.h>
 #else
+#ifndef BOOL_DEFINED
+#define BOOL_DEFINED
 typedef int bool;
 #endif
 #endif
+#endif
 
 #define SCALE_SCREEN 1.0
 #warning "PORT THE get_screen_dpi to Qt"
diff --git a/divelist.h b/divelist.h
index d17ea7c..7157ea3 100644
--- a/divelist.h
+++ b/divelist.h
@@ -7,9 +7,12 @@ extern "C" {
 #if __STDC_VERSION__ >= 199901L
 #include <stdbool.h>
 #else
+#ifndef BOOL_DEFINED
+#define BOOL_DEFINED
 typedef int bool;
 #endif
 #endif
+#endif
 
 struct dive;
 
diff --git a/profile.h b/profile.h
index 2c293fa..9e9cc44 100644
--- a/profile.h
+++ b/profile.h
@@ -7,9 +7,12 @@ extern "C" {
 #if __STDC_VERSION__ >= 199901L
 #include <stdbool.h>
 #else
+#ifndef BOOL_DEFINED
+#define BOOL_DEFINED
 typedef int bool;
 #endif
 #endif
+#endif
 
 #include "dive.h"
 
-- 
1.8.1.3



More information about the subsurface mailing list