[FFmpeg-user] Unable to compile C program which uses libavcodec and libavformat

Nicolas George nicolas.george at normalesup.org
Tue Mar 3 09:16:02 CET 2009


Le tridi 13 ventôse, an CCXVII, Jaikishan a écrit :
> gcc -o tutorial01 tutorial01.c -lavutil -lavformat -lavcodec -lz -lavutil -lm
> 
> /usr/local/lib/libavcodec.a(libfaac.o): In function `Faac_encode_frame':
> /home/jaikishan/x264/ffmpeg/libavcodec/libfaac.c:128: undefined reference to
> `faacEncEncode'
> collect2: ld returned 1 exit status

You are attempting to link your program with static lavf/lavc. Shared
libraries can include a list of the libraries they depend on, but static
libraries do not: they are just a collection of object files where the
linker takes what it needs.

Therefore, if a static library requires symbols from another library, that
other library must appear on the build command line.

Another catch with static libraries is that they must appear on the command
line after any code that require them.

It seems your lavc was built with faac support: you have to add -lfaac.
Other similar errors may require similar corrections.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-user/attachments/20090303/22ab147e/attachment.pgp>


More information about the ffmpeg-user mailing list