This sketch does not compile in the Arduino IDE
void setup() {
// put your setup code here, to run once:
}
struct test {
int i;
char variable[];
};
typedef struct test test;
test t = {
0, "hi"
};
void loop() {
// put your main code here, to run repeatedly:
}
Arduino throws
sketch_may09a:16: error: initializer-string for array of chars is too long [-fpermissive]
};
^
exit status 1
initializer-string for array of chars is too long [-fpermissive]
However compiling with g++ works just fine. How can I fix it? Or is there a principle reason why flexible array members are not supported?