警告:扩展的初始化程序列表仅适用于std c ++ 11 [英] warning: extended initializer lists only available with std c++ 11
本文介绍了警告:扩展的初始化程序列表仅适用于std c ++ 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用以下代码时得到警告:
Getting warning while using below code:
警告:扩展的初始化程序列表仅适用于std c ++ 11
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.
推荐答案
const test atest[] = { {2,3}, {4,5} };
您忘记了逗号,在C语言中需要 struct $如果未键入
test
,则使用c $ c>关键字:
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} };
这篇关于警告:扩展的初始化程序列表仅适用于std c ++ 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文