[Ffmpeg-devel] Linking statically against libavcodec

Michel Bardiaux mbardiaux
Mon Apr 2 12:14:38 CEST 2007

Julian Lamberty wrote:
> Hello!
> I'm having a problem linking statically against the 
> libavcodec/libaformat libs. I included the header files in myprog.c
> After building myprog.o from myprog.c I use "gcc myprog.o 
> -Lffmpeg/libavcodec/libavcodec.a -Lffmpeg/libavformat/libavformat.a -o 
> myprog" but gcc reports many undefined references ("av_register_all()", 
> "av_open_input_file()",...). Aren't these functions included in the 
> libs? What other files do I have to link against?
> Thanks for your help.
> Julian

(1) Either use -Lffmpeg/libavformat -lavformat, or simply 
ffmpeg/libavformat/libavformat.a. Ditto for the other ffmpeg libs.

(2) With static libs, order matters. Besides you need libavutil too. 
Hence it must be

libavformat libavcodec libavutil

(3) Questions about developping *with* the ffmpeg libraries, belong on 
ffmpeg-user. ffmpeg-devel is reserved for the development *of* ffmpeg.

Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles

More information about the ffmpeg-devel mailing list