Error C4576 in VS2015 enterprise

前端 未结 4 1548
清歌不尽
清歌不尽 2021-01-12 12:08

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

相关标签:
4条回答
  • 2021-01-12 12:43

    Old question, but... The solution is pretty simple:

    AVRational tb;
    tb.num = 1;
    tb.den = enc_ctx->sample_rate;
    
    enc_ctx->time_base = tb;
    

    or

    enc_ctx->time_base.num = 1;
    enc_ctx->time_base.den = enc_ctx->sample_rate;
    
    0 讨论(0)
  • 2021-01-12 12:52

    Remove the parenthesis around the type in the macro definition. That should work.

    enc_ctx->time_base = AVRational { 1, enc_ctx->sample_rate };
    
    0 讨论(0)
  • 2021-01-12 13:03

    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.

    0 讨论(0)
  • 2021-01-12 13:05

    Looks like a question where the C and C++ tags make sense. You're trying to compile C99 code with a C++ compiler. That doesn't work.

    0 讨论(0)
提交回复
热议问题