[libav-api] Linking errors with mingw

Anton Khirnov anton at khirnov.net
Thu Oct 17 17:53:38 CEST 2013

On Thu, 17 Oct 2013 10:44:23 -0400, Brian Mearns <bmearns at ieee.org> wrote:
> I'm trying to build a very minimal program from the ffmpeg src
> distributions examples, and it seems it can't find any of the libav*
> functions.
> I'm running windows 7 (64-bit) and mingw gcc version 4.7.1.
> I've just downloaded version 9.7 of libav from
> http://win32.libav.org/releases/libav-9.7-win64.7z, and unpacked it so that
> bin/, include/, lib/, and share/ are all under C:\apps\pf\libav\.
> From the ffmpeg examples (external to libav), I can run pkg-config and get
> the options for libav, and I use the following commands to compile and
> link, respectively:
> >gcc -o metadata.obj -c -IC:\apps\pf\libav\include metadata.c
> >gcc -o metadata.exe metadata.obj -LC:\apps\pf\libav\lib -lavutil
> -lavdevice -lavformat -lavfilter -lavcodec -lavresample -lswscale

Order matters here, libraries must appears in the order of dependency. lavf
depends on lavc, lavfi on sws and lavr, everything depends on lavu. That means
that -lavcodec must be after -lavformat, -lavutil must be last, etc.

Anton Khirnov

More information about the libav-api mailing list