H
I’m not sure if this is the correct forum.
I’m using PlatformIO within VSC and using ESP8266 and ESP32 arduino libraries.
Simply put when I have the following…see example below:
somewhere in the main code I create the object as below…
ObjA newObject(value1, value2, value3, value4);`
The definition of this class looks like below (note the class order of inherited classes and the constructor are different):
class ObjA : public ObjB, public ObjC, public ObjD
{
public:
// constructor...NOTE: inheritance DOES not match the class definition in terms of order
ObjA() : ObjB(int value1) : ObjA(int value2) : ObjD(int value3) : ObjC(int value4)
{
}
.....
};
In the above case it compiles fine with ESP8266 and with no warnings BUT with ESP32 it fails to compile
The error is:
error: base 'ObjD' will be initialised after [-Werror=reorder]
However if I change the order of the class definition to match the constructor it compiles fine for ESP32 i.e.
class ObjA : public ObjB, public ObjC, public ObjD
{
public:
// constructor...inheritance matched the class definition in terms of order
ObjA() : ObjA(int value1) : ObjB(int value2) : ObjC(int value3) : ObjD(int value4)
{
}
.....
};
Anyone with better knowledge of C++ and the compiler know what may be going on ?