VS2015 企业版中的错误 C4576

编程入门 行业动态 更新时间:2024-10-09 13:33:55
本文介绍了VS2015 企业版中的错误 C4576的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-27 16:10:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1157104.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版中   错误   企业

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!