私はこれらの構造を持っています:
struct menu_item{
int id;
char *text;
};
struct menu_tab{
char *label;
unsigned char item_count;
struct menu_item *items;
};
struct menu_page{
char *label;
unsigned char tab_count;
struct menu_tab *tabs;
};
struct Tmenu{
unsigned char page_count;
struct menu_page *pages;
};
そして、メニューシステム全体を定義したいと思います。
struct Tmenu menu_test = {
2,
{
"F1",
2,
{
{
"File",
8,
{
{1, "text 1"},
{2, "text2"},
{3, "text3333333"},
{4, "text4"},
{5, "Hello"},
{6, "42"},
{7, "world"},
{8, "!!!!!!!!"}
}
},
{
"File2",
3,
{
{11, "file2 text 1"},
{12, "blah"},
{13, "..."}
}
}
}
},
{
"F2",
1,
{
{
"File3",
5,
{
{151, "The Answer To Life"},
{152, "The Universe"},
{153, "and everything"},
{154, "iiiiiiiiiiiiiiiis"},
{42, "Fourty-Two"}
}
}
}
}
};
しかし、コンパイルしようとすると、 extra brace group at end of initializer
エラーメッセージが表示されます。
私はそれを行うために多くの異なる方法を試しましたが、どれも成功しませんでした。では、このようにCで複雑な構造体を使用することは可能ですか?