[Libav-user] linker error while compiling decoding_encoding.c

satya gowtham kudupudi satyagowtham.k at gmail.com
Sat Sep 28 16:20:33 CEST 2013


Yes this is the duplicate post but this time I am right away compiling
http://www.ffmpeg.org/doxygen/2.0/doc_2examples_2decoding_encoding_8c-example.html
without
including it in any other application. I've rebuilt ffmpeg as guided at
http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide and ran following
command with the following output

g++ -D__STDC_CONSTANT_MACROS   -c -g -Iffmpeg_build/include
-D__STDC_CONSTANT_MACROS -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o
build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -D__STDC_CONSTANT_MACROS    -o dist/Debug/GNU-Linux-x86/test
build/Debug/GNU-Linux-x86/main.o ffmpeg_build/lib/libavformat.a
ffmpeg_build/lib/libavcodec.a ffmpeg_build/lib/libswscale.a
ffmpeg_build/lib/libavdevice.a ffmpeg_build/lib/libavfilter.a
ffmpeg_build/lib/libavutil.a
build/Debug/GNU-Linux-x86/main.o: In function `select_channel_layout':
/home/gowtham/NetBeansProjects/test/main.cpp:77: undefined reference to
`av_get_channel_layout_nb_channels(unsigned long long)'
build/Debug/GNU-Linux-x86/main.o: In function `audio_encode_example':
/home/gowtham/NetBeansProjects/test/main.cpp:102: undefined reference to
`avcodec_find_encoder(AVCodecID)'
/home/gowtham/NetBeansProjects/test/main.cpp:107: undefined reference to
`avcodec_alloc_context3(AVCodec const*)'
/home/gowtham/NetBeansProjects/test/main.cpp:118: undefined reference to
`av_get_sample_fmt_name(AVSampleFormat)'
/home/gowtham/NetBeansProjects/test/main.cpp:124: undefined reference to
`av_get_channel_layout_nb_channels(unsigned long long)'
/home/gowtham/NetBeansProjects/test/main.cpp:126: undefined reference to
`avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'
/home/gowtham/NetBeansProjects/test/main.cpp:136: undefined reference to
`avcodec_alloc_frame()'
/home/gowtham/NetBeansProjects/test/main.cpp:147: undefined reference to
`av_samples_get_buffer_size(int*, int, int, AVSampleFormat, int)'
/home/gowtham/NetBeansProjects/test/main.cpp:148: undefined reference to
`av_malloc(unsigned int)'
/home/gowtham/NetBeansProjects/test/main.cpp:156: undefined reference to
`avcodec_fill_audio_frame(AVFrame*, int, AVSampleFormat, unsigned char
const*, int, int)'
/home/gowtham/NetBeansProjects/test/main.cpp:165: undefined reference to
`av_init_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:175: undefined reference to
`avcodec_encode_audio2(AVCodecContext*, AVPacket*, AVFrame const*, int*)'
/home/gowtham/NetBeansProjects/test/main.cpp:182: undefined reference to
`av_free_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:187: undefined reference to
`avcodec_encode_audio2(AVCodecContext*, AVPacket*, AVFrame const*, int*)'
/home/gowtham/NetBeansProjects/test/main.cpp:194: undefined reference to
`av_free_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:198: undefined reference to
`av_freep(void*)'
/home/gowtham/NetBeansProjects/test/main.cpp:199: undefined reference to
`avcodec_free_frame(AVFrame**)'
/home/gowtham/NetBeansProjects/test/main.cpp:200: undefined reference to
`avcodec_close(AVCodecContext*)'
/home/gowtham/NetBeansProjects/test/main.cpp:201: undefined reference to
`av_free(void*)'
build/Debug/GNU-Linux-x86/main.o: In function `audio_decode_example':
/home/gowtham/NetBeansProjects/test/main.cpp:215: undefined reference to
`av_init_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:218: undefined reference to
`avcodec_find_decoder(AVCodecID)'
/home/gowtham/NetBeansProjects/test/main.cpp:223: undefined reference to
`avcodec_alloc_context3(AVCodec const*)'
/home/gowtham/NetBeansProjects/test/main.cpp:229: undefined reference to
`avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'
/home/gowtham/NetBeansProjects/test/main.cpp:240: undefined reference to
`av_free(void*)'
/home/gowtham/NetBeansProjects/test/main.cpp:249: undefined reference to
`avcodec_alloc_frame()'
/home/gowtham/NetBeansProjects/test/main.cpp:254: undefined reference to
`avcodec_get_frame_defaults(AVFrame*)'
/home/gowtham/NetBeansProjects/test/main.cpp:255: undefined reference to
`avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, AVPacket const*)'
/home/gowtham/NetBeansProjects/test/main.cpp:264: undefined reference to
`av_samples_get_buffer_size(int*, int, int, AVSampleFormat, int)'
/home/gowtham/NetBeansProjects/test/main.cpp:286: undefined reference to
`avcodec_close(AVCodecContext*)'
/home/gowtham/NetBeansProjects/test/main.cpp:287: undefined reference to
`av_free(void*)'
/home/gowtham/NetBeansProjects/test/main.cpp:288: undefined reference to
`avcodec_free_frame(AVFrame**)'
build/Debug/GNU-Linux-x86/main.o: In function `video_encode_example':
/home/gowtham/NetBeansProjects/test/main.cpp:304: undefined reference to
`avcodec_find_encoder(AVCodecID)'
/home/gowtham/NetBeansProjects/test/main.cpp:309: undefined reference to
`avcodec_alloc_context3(AVCodec const*)'
/home/gowtham/NetBeansProjects/test/main.cpp:325: undefined reference to
`av_opt_set(void*, char const*, char const*, int)'
/home/gowtham/NetBeansProjects/test/main.cpp:327: undefined reference to
`avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'
/home/gowtham/NetBeansProjects/test/main.cpp:336: undefined reference to
`avcodec_alloc_frame()'
/home/gowtham/NetBeansProjects/test/main.cpp:347: undefined reference to
`av_image_alloc(unsigned char**, int*, int, int, AVPixelFormat, int)'
/home/gowtham/NetBeansProjects/test/main.cpp:354: undefined reference to
`av_init_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:374: undefined reference to
`avcodec_encode_video2(AVCodecContext*, AVPacket*, AVFrame const*, int*)'
/home/gowtham/NetBeansProjects/test/main.cpp:382: undefined reference to
`av_free_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:388: undefined reference to
`avcodec_encode_video2(AVCodecContext*, AVPacket*, AVFrame const*, int*)'
/home/gowtham/NetBeansProjects/test/main.cpp:396: undefined reference to
`av_free_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:402: undefined reference to
`avcodec_close(AVCodecContext*)'
/home/gowtham/NetBeansProjects/test/main.cpp:403: undefined reference to
`av_free(void*)'
/home/gowtham/NetBeansProjects/test/main.cpp:404: undefined reference to
`av_freep(void*)'
/home/gowtham/NetBeansProjects/test/main.cpp:405: undefined reference to
`avcodec_free_frame(AVFrame**)'
build/Debug/GNU-Linux-x86/main.o: In function `decode_write_frame':
/home/gowtham/NetBeansProjects/test/main.cpp:427: undefined reference to
`avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket const*)'
build/Debug/GNU-Linux-x86/main.o: In function `video_decode_example':
/home/gowtham/NetBeansProjects/test/main.cpp:456: undefined reference to
`av_init_packet(AVPacket*)'
/home/gowtham/NetBeansProjects/test/main.cpp:461: undefined reference to
`avcodec_find_decoder(AVCodecID)'
/home/gowtham/NetBeansProjects/test/main.cpp:466: undefined reference to
`avcodec_alloc_context3(AVCodec const*)'
/home/gowtham/NetBeansProjects/test/main.cpp:477: undefined reference to
`avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'
/home/gowtham/NetBeansProjects/test/main.cpp:486: undefined reference to
`avcodec_alloc_frame()'
/home/gowtham/NetBeansProjects/test/main.cpp:520: undefined reference to
`avcodec_close(AVCodecContext*)'
/home/gowtham/NetBeansProjects/test/main.cpp:521: undefined reference to
`av_free(void*)'
/home/gowtham/NetBeansProjects/test/main.cpp:522: undefined reference to
`avcodec_free_frame(AVFrame**)'
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/gowtham/NetBeansProjects/test/main.cpp:529: undefined reference to
`avcodec_register_all()'
collect2: error: ld returned 1 exit status

If link order is wrong please suggest the correct order. I've been trying
to compile the example since yesterday.

Thank you
-- 
*Gowtham*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130928/790d8446/attachment.html>


More information about the Libav-user mailing list