[Libav-user] undefined reference to avformat_write_header

Matthew Einhorn moiein2000 at gmail.com
Mon Aug 1 15:12:36 CEST 2011


On Mon, Aug 1, 2011 at 7:56 AM, Sabine Bachmayer
<sabine.bachmayer at jku.at> wrote:
> Hi!
>
> I'm using the libraries of ffmpeg 0.7.1 in ubuntu 10.10.
> All in all, the libraries work great in Eclipse CDT (using C++) but I
> have problems using avformat_write_headers(AVFormatContext*,
> AVDictionary**) instead of the deprecated function av_write_header. I
> always get the following error during compilation:
> undefined reference to `avformat_write_header' C/C++ Problem
>
> The weird thing is, that I'm able to use other functions that are
> declared in libavformat/avformat.h and implemented in
> libavformat/utils.c - for example av_guess_format(...) and
> av_set_parameters(...), etc.
>
> There seems to be no mistakes in the usage of avformat_write_headers
> which is the following:
> avformat_write_header(pFormatCtx,NULL);
> where pFormatCtx is of type AVFormatContext* including a previously
> opened mpeg file.
>
> I checked the include paths for C++ and C compilers as well as the
> include libraries and library search path for the linker.
>
> I also tried to include libavformat/utils.c directly, but in this case I
> get 44 compiler errors in utils.c which is weird as well because I
> already compiled ffmpeg successfully by using its makefile.
>
> Any idea where the mistake could be?
>

You did remember to wrap the include declarations with extern c?

> Thank you very much for your help!
>
> Kind regards,
> Sabine
>
>
>
>
>
>
>
>
>
>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Filtered-With-Copfilter: Version 0.85.2 (ProxSMTP 1.8)
> by Markus Madlener @ http://www.copfilter.org
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>


More information about the Libav-user mailing list