Errors compiling in Visual Studio 2013
V T

Hello all,

I have switched from Visual Studio 2008 to Visual Studio 2013. I have two different Allegro projects saved. One of them opens and compiles without issue, the other does not. The one that doesn't compile gives me the following:

Error 1 error C2632: 'char' followed by 'bool' is illegal c:\allegro5\include\allegro5\platform\astdbool.h 26 1 mm
Warning 2 warning C4091: 'typedef ' : ignored on left of 'unsigned char' when no variable is declared c:\allegro5\include\allegro5\platform\astdbool.h 26 1 mm

The section of code that the compiler is erroring out on is from astdbool.h:

#SelectExpand
1#ifndef __al_included_allegro5_astdbool_h 2#define __al_included_allegro5_astdbool_h 3 4#ifndef __cplusplus 5# ifdef ALLEGRO_HAVE_STDBOOL_H 6# include <stdbool.h> 7# else 8# ifndef ALLEGRO_HAVE__BOOL 9 typedef unsigned char _Bool; // this is the line the errors reference 10# endif 11# define bool _Bool 12# define false 0 13# define true 1 14# define __bool_true_false_are_defined 1 15# endif 16#endif 17 18#endif

Has anyone encountered this before?

Peter Hull

I had the same.

It's because (I think) VC13 has stdbool.h and older versions don't.
I fixed it by editing include/allegro5/platform/alplatf.h and changing the line

/* #undef ALLEGRO_HAVE_STDBOOL_H */

to

#define ALLEGRO_HAVE_STDBOOL_H 

If you're compiling from source I think you can edit alplatf.h.cmake - not sure about that.

Pete

V T

Peter,

Thank you sir, that fixed it!

VT

Thread #614655. Printed from Allegro.cc