Page 1 of 1

Compiler Error with Bool

PostPosted: 07 Nov 2016, 02:34
by dulsi
Bt Builder is failing on powerpc. It gets:

{l Code}: {l Select All Code}
src/psuedo3d.h:18:129: error: could not convert 'true' from 'bool' to '__vector(4) __bool int'
   virtual void loadImageOrAnimation(const char *file, SDL_Surface **img, MNG_Image **animation, bool imageWindow, bool physfs = true) = 0;
                                                                                                                                 ^~~~

I've been told that it can be fixed by -std=gnu++11 instead of using -std=c++11. I was wondering if anyone knows why. Is it bug in the compiler or my code?

Re: Compiler Error with Bool

PostPosted: 07 Nov 2016, 04:43
by Lyberta
Deleted.

Re: Compiler Error with Bool

PostPosted: 12 Dec 2016, 22:12
by Pix3l
Look if that the source include stdbool.h, maybe is just that the problem :]

Re: Compiler Error with Bool

PostPosted: 13 Dec 2016, 03:54
by Lyberta
Deleted.

Re: Compiler Error with Bool

PostPosted: 07 Apr 2017, 16:49
by dulsi
From Bug 1394505:

f you build with -std=c++11 (or any other strict ISO mode) and include altivec.h, that is to be expected, altivec.h redefines bool and vector for the Altivec purposes, so if you want to use it in C++ code, you need to include altivec.h after all STL headers and if you want to use bool/vector the way it is used normally in C++, you need to #undef them afterwards. In -std=gnu++11 and other GNU modes GCC uses conditional preprocessor macros that act as the Altivec macros in certain contexts and as normal C++ bool/vector in other contexts.


I don't find the answer very satisfying. Since it compiles on everything except PowerPC, something is including altivec.h on that platform. I have no idea what. Even if I found it and moved everything so that altivec.h is included last, someone could decide they need altivec in a library I use and break the build again. So I'm stuck using gnu++11.