Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error C4576 in VS2015 enterprise

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.org/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

like image 459
HDJEMAI Avatar asked Oct 21 '15 23:10

HDJEMAI


1 Answers

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.

like image 87
AnT Avatar answered Sep 29 '22 13:09

AnT