[libav-api] Linking errors with mingw

Brian Mearns bmearns at ieee.org
Fri Oct 18 03:08:17 CEST 2013


On Thu, Oct 17, 2013 at 12:05 PM, Brian Mearns <bmearns at ieee.org> wrote:
> On Thu, Oct 17, 2013 at 11:53 AM, Anton Khirnov <anton at khirnov.net> wrote:
>>
>>
>> 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
>
> Thanks, but it hasn't helped. I tried trimming down the libraries and
> putting them in the order you specified, and got the exact same
> errors. My command is now:
>
> gcc -o metadata.exe metadata.obj -LC:\apps\pf\libav\lib -lavformat
> -lavcodec -lavutil
>
> -Brian

My problem was that I was building with mingw, not mingw-w64. Once I
finally got mingw-64 installed, I am able to build against libav.

-Brian


More information about the libav-api mailing list