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

Dirk Hohndel dirk at hohndel.org
Sun May 5 14:35:37 PDT 2013


I'd actually prefer to have this just once in dive.h and have the other 
files include dive.h

/D



On May 5, 2013 2:02:17 PM subsurface at henrik.synth.no wrote:
> 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
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface




More information about the subsurface mailing list