Thanks for the reply! The error generated is not because of missing header-files. The header-files isn't missing. [See also this thead: http://stackoverflow.com/questions/9701764/undefined-reference-using-ffmpeg-library-avcodec-on-ubuntu-64-bits-system]
The same error is generated including the header-files specifically (see below) (that otherwise automatically are added): gcc videofecencoder.cc -I/usr/include/libavcodec -I/usr/include/libavformat -I/usr/include/libavutil -lavformat -lavcodec -lavutil /tmp/cc7FFtFo.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+0xfc): undefined reference to `av_opt_set(void*, char const*, char const*, int)' videofecencoder.cc:(.text+0x116): undefined reference to `avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)' videofecencoder.cc:(.text+0x1e2): undefined reference to `av_image_alloc(unsigned char**, int*, int, int, PixelFormat, int)' videofecencoder.cc:(.text+0x330): undefined reference to `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)' videofecencoder.cc:(.text+0x3b3): undefined reference to `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)' videofecencoder.cc:(.text+0x464): undefined reference to `avcodec_close(AVCodecContext*)' videofecencoder.cc:(.text+0x46f): undefined reference to `av_free(void*)' videofecencoder.cc:(.text+0x47c): undefined reference to `av_free(void*)' videofecencoder.cc:(.text+0x487): undefined reference to `av_free(void*)' /tmp/cc7FFtFo.o: In function `main': videofecencoder.cc:(.text+0x4a8): undefined reference to `avcodec_register_all()' collect2: ld returned 1 exit status 2012/3/16 Andrey Utkin <[email protected]> > 2012/3/16 Anders Branderud <[email protected]>: > > Hello! > > > > When I run the encoding example (code inserted to the following cc-file) > > provided in doc/examples of the FFMpeg-library and compile it with the > > line linux-y8h9:/home/anders/Programs # g++ videofecencoder.cc -lavformat > > -lavcodec -lavutil > > > > I get the following error message: > > /tmp/ccDQpTY5.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+0xfc): undefined reference to > `av_opt_set(void*, > > char const*, char const*, int)' > > videofecencoder.cc:(.text+0x116): undefined reference to > > `avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)' > > videofecencoder.cc:(.text+0x1e2): undefined reference to > > `av_image_alloc(unsigned char**, int*, int, int, PixelFormat, int)' > > videofecencoder.cc:(.text+0x330): undefined reference to > > `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame > const*)' > > videofecencoder.cc:(.text+0x3b3): undefined reference to > > `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame > const*)' > > videofecencoder.cc:(.text+0x464): undefined reference to > > `avcodec_close(AVCodecContext*)' > > videofecencoder.cc:(.text+0x46f): undefined reference to `av_free(void*)' > > videofecencoder.cc:(.text+0x47c): undefined reference to `av_free(void*)' > > videofecencoder.cc:(.text+0x487): undefined reference to `av_free(void*)' > > /tmp/ccDQpTY5.o: In function `main': > > videofecencoder.cc:(.text+0x4a8): undefined reference to > > `avcodec_register_all()' > > collect2: ld returned 1 exit status > > > > I have tried the same using two different Ubuntu-installations. The above > > compilation was performed using OpenSUSE installed in a VirtualBox. I did > > the above at a new installation of OpenSUSE. After installing it I > > downloaded the required libraries using the libraries provided in the > > Software repository called 'PackMan'. > > You lack libraries' header files. Find and install packages that > contain files /usr/include/libavformat/avformat.h, > /usr/include/libavcodec/avcodec.h . I hope you got the point. I don't > know exact package names for suse and ubuntu. > > -- > Andrey Utkin > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user > -- *Kind regards,* [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
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
