I got this error when trying to build our game Burnt Islands for Linux. It was bepuzzling. There was nothing wrong with the syntax, it compiled under Windows with no problems. I know G++ have its quirks, however, this was strange.
This was the original code it didn’t like.
class KeyMessage : public Message<MESSAGE_KEY> { public: explicit KeyMessage( bool pressed, Key key, bool shift, bool ctrl, bool continuous ) : Message() , pressed( pressed ) , key( key ) , shift( shift ) , CTRL( ctrl ) , continuous( continuous ) { } virtual ~KeyMessage() {} public: bool pressed; Key key; bool shift; bool CTRL; bool continuous; };
The error given was this
KeysMessages.hpp: In constructor ‘KeyMessage::KeyMessage(bool, framework::messages::Key, bool, bool, bool)’: KeysMessages.hpp:107:8: error: anachronistic old-style base class initializer [-fpermissive] KeysMessages.hpp:102:14: error: multiple initializations given for base ‘Message’
It turned out there is a macro with the name CTRL
hidden somewhere in the includes in Linux.
The fix was very simple. I had only to rename CTRL
to Ctrl
, and then it compiled willingly under both Windows and Linux.
Next time this error comes around, it is probably a macro doing strange things with your code.