diff options
| author | Ahmad Fatoum <ahmad@a3f.at> | 2018-10-07 00:34:50 +0200 |
|---|---|---|
| committer | Ahmad Fatoum <ahmad@a3f.at> | 2018-10-07 00:39:51 +0200 |
| commit | 6572d5ff8c3299d3915f2b3155ef2275baa971fd (patch) | |
| tree | 4982ccc382062699dd1c379d4aa10eff9cc8260a /src | |
| parent | a56b3c21942737208a4f54f869b239b1d293cb00 (diff) | |
| download | raylib-6572d5ff8c3299d3915f2b3155ef2275baa971fd.tar.gz raylib-6572d5ff8c3299d3915f2b3155ef2275baa971fd.zip | |
raylib.h: include <stdbool.h> if available
Previously, if <raylib.h> was #included prior to another header that
defined bool, the compilation would fail.
This is e.g. the case for <perl.h> and <objc/objc.h> which both fall
back to the <stdbool.h> if C99 is available.
The following commit includes <objc/objc.h> in src/core.c, which causes
the same problem.
Avoid this by checking for C99 bool like we already do for C++'s.
Diffstat (limited to 'src')
| -rw-r--r-- | src/raylib.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/raylib.h b/src/raylib.h index 17c4234e..20a3ca26 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -354,11 +354,11 @@ //---------------------------------------------------------------------------------- // Structures Definition //---------------------------------------------------------------------------------- -#ifndef __cplusplus // Boolean type - #ifndef bool - typedef enum { false, true } bool; - #endif +#if defined(__STDC__) && __STDC_VERSION__ >= 199901L + #include <stdbool.h> +#elif !defined(__cplusplus) && !defined(bool) + typedef enum { false, true } bool; #endif // Vector2 type |
