您的位置:首页 > 其它

关于C99中的新特性:指定初始化 Designated initializers

2015-02-15 16:43 141 查看

在MSDN上找到个帖子:

SYNTAX ERROR : ( FFMPEG SOURCE CODE RUNNING ON VS2012)

在VS2012上编译ffmpeg遇到错误:

AVInputFormat ff_yop_demuxer = {

.name = "yop", // error on dot operater

.long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP"),

.priv_data_size = sizeof(YopDecContext),

.read_probe = yop_probe,

.read_header = yop_read_header,

.read_packet = yop_read_packet,

.read_close = yop_read_close,

.read_seek = yop_read_seek,

.extensions = "yop",

.flags = AVFMT_GENERIC_INDEX,

};

对结构体中的成员 进行指定初始化,例如: .name = "yop", 在VS2010 、VS2012 上不支持,VS2013才支持

编译时报错,就是下图中 红色的地方


https://social.msdn.microsoft.com/Forums/vstudio/en-US/66a83f44-11d7-4630-9c52-b47db0fe9f66/syntax-error-ffmpeg-source-code-running-on-vs2012?forum=vcgeneral http://www.drdobbs.com/the-new-c-declarations-initializations/184401377 http://www.cnblogs.com/shadow21/p/4076986.html http://stackoverflow.com/questions/23986521/c2059-in-vs2012-how-to-initialize-struct-instance http://blog.csdn.net/adaptiver/article/details/7494081 http://blog.csdn.net/chgaowei/article/details/8629819
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: