[FFmpeg-user] 'Undefined reference'-error when compiling FFMpeg

Anders Branderud anders.branderud at gmail.com
Thu Mar 15 19:54:14 CET 2012


Hello!

Here follows a problem that I would need your help with:
I have installed the latest FFMpeg-library. I have tried to link to the
library using two different Ubuntu-installations without any success.

When I run the command
'ubuntu at ubuntu:/media/6982d030-e492-4bc9-a1e4-b674ef78cff0/home/david/Programs$
sudo g++ -Iffmpeg/ -L/usr/lib videofecencoder.cc
/media/6982d030-e492-4bc9-a1e4-b674ef78cff0/home/david/Programs/ffmpeg/libavformat/libavformat.a
libavformat.so.53 -pthread', I get this error:
ubuntu at ubuntu:/media/6982d030-e492-4bc9-a1e4-b674ef78cff0/home/david/Programs$
sudo g++ -Iffmpeg/ -L/usr/lib videofecencoder.cc
/media/6982d030-e492-4bc9-a1e4-b674ef78cff0/home/david/Programs/ffmpeg/libavformat/libavformat.a
/media/6982d030-e492-4bc9-a1e4-b674ef78cff0/home/david/Programs/ffmpeg/libavutil/libavutil.a
libavformat.so.53 -pthread
/tmp/ccpX60ph.o: In function `video_encode_example(char const*, int)':
videofecencoder.cc:(.text+0x30): undefined reference to
`avcodec_find_encoder(CodecID)'
videofecencoder.cc:(.text+0x75): undefined reference to
`avcodec_alloc_context3(AVCodec*)'
videofecencoder.cc:(.text+0x7d): undefined reference to
`avcodec_alloc_frame()'
videofecencoder.cc:(.text+0x108): undefined reference to `av_opt_set(void*,
char const*, char const*, int)'
videofecencoder.cc:(.text+0x122): undefined reference to
`avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)'
videofecencoder.cc:(.text+0x1f4): undefined reference to
`av_image_alloc(unsigned char**, int*, int, int, PixelFormat, int)'
videofecencoder.cc:(.text+0x348): undefined reference to
`avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)'
videofecencoder.cc:(.text+0x3cb): undefined reference to
`avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)'
videofecencoder.cc:(.text+0x47c): undefined reference to
`avcodec_close(AVCodecContext*)'
videofecencoder.cc:(.text+0x487): undefined reference to `av_free(void*)'
videofecencoder.cc:(.text+0x494): undefined reference to `av_free(void*)'
videofecencoder.cc:(.text+0x49f): undefined reference to `av_free(void*)'
/tmp/ccpX60ph.o: In function `main':
videofecencoder.cc:(.text+0x4c0): undefined reference to
`avcodec_register_all()'
collect2: ld returned 1 exit status
ubuntu at ubuntu
:/media/6982d030-e492-4bc9-a1e4-b674ef78cff0/home/david/Programs

What should I do to resolve the above?

Thanks!
-- Anders Branderud
[Personal blog] Will of the
Creator<http://www.proofexistencegod.com/will-of-god/will-of-god/>  :
Logical
reasons - based on scientific premises - for the existence of a Super
intelligent and Orderly Creator and that He hasn't left His sapient
creatures without an Instruction Manual - Torah ['books of Moses'] - to
ascertain, and aspire to, His purpose.

[Company] Anders Branderud IT Solutions - www.abitsolutions.org


More information about the ffmpeg-user mailing list