问题
Getting warning while using below code:
warning: extended initializer lists only available with std c++ 11
struct test{
int a;
int b;
};
//Previously const test atest[] = { {2,3} {4,5} };
const test atest[] = { {2,3} , {4,5} };
How can I remove this? I tried with solution, but it didn't work.
回答1:
const test atest[] = { {2,3}, {4,5} };
You forget the comma, and in C you need the struct
keyword if test
is not typedefed:
const struct test atest[] = { {2,3}, {4,5} };
来源:https://stackoverflow.com/questions/25281065/warning-extended-initializer-lists-only-available-with-std-c-11