[Libav-user] Compile with g++
Michael Chisholm
chisholm at mitre.org
Tue Oct 8 21:55:34 CEST 2013
On 10/8/2013 2:12 PM, James Board wrote:
>> "How difficult would it be to compile the examples in the doc/examples
>> directory with a C++ compiler?"
>>
>> Those are C programs, so just use a C compiler for them. That's all I
>> meant.
>
> Okay, I understand. Yes they are just C programs, so I can compile with
> the C compiler. But my C++ programs with libav subroutine calls won't
> compile and the error messages I receive are the same as when I try to compile
> the doc/examples with C++. So, rather then posting my C++ code, it's easier
> to debug the problems by merely trying to compile the doc/examples with the
> C++ compiler
>
>> So I just added it myself, around my C includes:
>>
>> extern "C" {
>> #include "libavformat/avformat.h"
>> etc...
>> }
>
> I tried exactly that with the demuxing.c example. When I try to compile
> it with the C++ compiler, I get errors. When I compile with the C compiler,
> no errors. What do I need to do to get demuxing.c to compile with the C++
> compiler in Linux?
>
You didn't describe the error messages, but I gave it a shot with
mingw32 4.8.1, and now I see error messages as well. E.g.
demuxing.c: In function 'int main(int, char**)':
demuxing.c:261:66: error: invalid conversion from 'void*' to 'uint8_t**
{aka unsigned char**}' [-fpermissive]
audio_dst_data = av_mallocz(sizeof(uint8_t *) * nb_planes);
^
Is that the kind of error you are seeing (this is from ffmpeg 2.0.1)? I
am admittedly using an older version of libav (0.8.6), not the latest
ffmpeg, and that works fine with C++ compilers. I hadn't realized it,
but it seems things have changed... which is good for me to know. I
don't know of an easy fix for this :(
Andy
More information about the Libav-user
mailing list