[Libav-user] ffmpeg static library linking issue

园袁 y11022053 at gmail.com
Fri Jul 6 08:56:53 CEST 2012


I encounterd this problem too, but I fix with below command.
"gcc xxx.c -o xxx -lavformat -lavcodec etc..."
if you get "undefined reference" error, you should use "grep" to find which
xx.a file contains the implement of that function, then plus the command
"-lxxx.a" in gcc.
hope this help u.

2012/7/5 …ÇÁ¢Ö¾ <lichih at daiseki.com.tw>

> > Hi All,
> > I compiled the ffmpeg source to generate the static(.a foramt) libraries
>  in linux.
> > When i am linking the static libraries with my application,
> > i am getting undefined reference for many functions.
> > Even i tried with pkg-config.
> > Here command , what i tried
>
> I have encountered the same problem, I solved this problem but I don't
> know why it works.
>
> old test.c:
>
> #include <libavcodec/avcodec.h>
> #include <libavformat/avformat.h>
>
> int main()
> {
>         av_register_all();
>         return 0;
> }
>
>
> new test.c:
>
> #include <libavcodec/avcodec.h>
> #include <libavformat/avformat.h>
>
> int main()
> {
>         avcodec_register_all();
>         av_register_all();
>         return 0;
> }
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120706/42c07263/attachment.html>


More information about the Libav-user mailing list