[Libav-user] g++ 4.7.2 fails to compile av_err2str

Alex Cohn alexcohn at netvision.net.il
Mon Jan 14 13:48:20 CET 2013

On Mon, Jan 14, 2013 at 1:31 PM, "René J.V. Bertin" <rjvbertin at gmail.com> wrote:
> On Jan 14, 2013, at 11:42, Alex Cohn wrote:
>>> used later on. Semantics imposed by C++?
>>> R.
>> An easy test proves that adding "-x c" to command line resolves the
>> problem. So it is a C++ artifact.
> As I feared.
> Note that the OP's tst_gxx.cpp does a simple
>         av_err2str(AVERROR_BUG);
> i.e. stand-alone instead of using the function call as an argument to another function as is stipulated in the doxygen doc for av_err2str in my version of the code. Is it certain that the scope and type of a variable declared (char[SIZE]){0} in a function argument list is well defined and identical across all compilers? I personally find it an unreadable and ambiguous construct...
> R

The C++ error does not go away if av_err2str() is wrapped into an
argument to another function, as


... but I believe that the solution is simple: this macro should not
be used in C++, that's it! Whoever needs similar functionality in g++,
may use

    #undef av_err2str
    #define av_err2str(errnum) \

More information about the Libav-user mailing list