问题描述
限时送ChatGPT账号..当我尝试编译文件 transcoding.c 时,我在 Visual Studio 2015 中遇到错误 C4576.
该文件的源代码在这里:transcoding.c><块引用>
错误 C4576:带括号的类型后跟初始值设定项列表是非标准的显式类型转换语法
错误出现在这条指令的第 127 行:
enc_ctx->time_base = (AVRational) { 1, enc_ctx->sample_rate };
我在我的项目中使用了ffmpeg的源码https://www.ffmpeg/download.html
我四处寻找解决方案,但我无法纠正错误
如果有人发现类似的东西,请提供一个想法
解决方案尽管其他一些答案错误地声称,VS2015 编译器提供了对 C99 功能的全面支持,包括您尝试使用的复合文字功能在那个有问题的行中使用.
该错误消息的一种可能解释是,尽管源文件被命名为 .c
文件,但它正在被编译为 C++ 文件.项目设置可能会显式请求此文件的 C++ 编译器.在 C++ 中,此代码无效.
检查您的编译设置,看看它是否包含 /TP
(编译为 C++")开关.
I have the error C4576 in Visual studio 2015 when I tried to compile the file: transcoding.c.
The source code of this file is here: transcoding.c
error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
The error arise at line 127 in this instruction:
enc_ctx->time_base = (AVRational) { 1, enc_ctx->sample_rate };
I used the source of ffmpeg in my project https://www.ffmpeg/download.html
I searched around for a solution but I'm not able to correct the error
If someone have found something similar, please provide an idea
解决方案Despite what some other answers incorrectly claim, VS2015 compiler provides comprehensive support for C99 features, including the compound literal feature you are trying to use in that problematic line.
One possible explanation for the error message is that it the source file, despite being named as .c
file, is being compiled as C++ file. The project settings might explicitly request C++ compiler for this file. In C++ this code is invalid.
Check your compilation settings to see if it by any chance includes a /TP
("compile as C++") switch.
这篇关于VS2015 企业版中的错误 C4576的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论