<div dir="ltr">Thanks for the reply!<br>The error generated is not because of missing header-files. The header-files isn't missing.<br>[See also this thead: <a href="http://stackoverflow.com/questions/9701764/undefined-reference-using-ffmpeg-library-avcodec-on-ubuntu-64-bits-system">http://stackoverflow.com/questions/9701764/undefined-reference-using-ffmpeg-library-avcodec-on-ubuntu-64-bits-system</a> ]<br>
<br>The same error is generated including the header-files specifically (see below) (that otherwise automatically are added):<br>gcc videofecencoder.cc -I/usr/include/libavcodec -I/usr/include/libavformat -I/usr/include/libavutil -lavformat -lavcodec -lavutil<br>
/tmp/cc7FFtFo.o: In function `video_encode_example(char const*, int)':<br>videofecencoder.cc:(.text+0x30): undefined reference to `avcodec_find_encoder(CodecID)'<br>videofecencoder.cc:(.text+0x75): undefined reference to `avcodec_alloc_context3(AVCodec*)'<br>
videofecencoder.cc:(.text+0x7d): undefined reference to `avcodec_alloc_frame()'<br>videofecencoder.cc:(.text+0xfc): undefined reference to `av_opt_set(void*, char const*, char const*, int)'<br>videofecencoder.cc:(.text+0x116): undefined reference to `avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)'<br>
videofecencoder.cc:(.text+0x1e2): undefined reference to `av_image_alloc(unsigned char**, int*, int, int, PixelFormat, int)'<br>videofecencoder.cc:(.text+0x330): undefined reference to `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)'<br>
videofecencoder.cc:(.text+0x3b3): undefined reference to `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)'<br>videofecencoder.cc:(.text+0x464): undefined reference to `avcodec_close(AVCodecContext*)'<br>
videofecencoder.cc:(.text+0x46f): undefined reference to `av_free(void*)'<br>videofecencoder.cc:(.text+0x47c): undefined reference to `av_free(void*)'<br>videofecencoder.cc:(.text+0x487): undefined reference to `av_free(void*)'<br>
/tmp/cc7FFtFo.o: In function `main':<br>videofecencoder.cc:(.text+0x4a8): undefined reference to `avcodec_register_all()'<br>collect2: ld returned 1 exit status<br><br><br><div class="gmail_quote">2012/3/16 Andrey Utkin <span dir="ltr"><<a href="mailto:andrey.krieger.utkin@gmail.com">andrey.krieger.utkin@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2012/3/16 Anders Branderud <<a href="mailto:anders.branderud@gmail.com">anders.branderud@gmail.com</a>>:<br>
<div><div class="h5">> Hello!<br>
><br>
> When I run the encoding example (code inserted to the following cc-file)<br>
> provided in doc/examples of the FFMpeg-library and compile it with the<br>
> line linux-y8h9:/home/anders/Programs # g++ videofecencoder.cc -lavformat<br>
> -lavcodec -lavutil<br>
><br>
> I get the following error message:<br>
> /tmp/ccDQpTY5.o: In function `video_encode_example(char const*, int)':<br>
> videofecencoder.cc:(.text+0x30): undefined reference to<br>
> `avcodec_find_encoder(CodecID)'<br>
> videofecencoder.cc:(.text+0x75): undefined reference to<br>
> `avcodec_alloc_context3(AVCodec*)'<br>
> videofecencoder.cc:(.text+0x7d): undefined reference to<br>
> `avcodec_alloc_frame()'<br>
> videofecencoder.cc:(.text+0xfc): undefined reference to `av_opt_set(void*,<br>
> char const*, char const*, int)'<br>
> videofecencoder.cc:(.text+0x116): undefined reference to<br>
> `avcodec_open2(AVCodecContext*, AVCodec*, AVDictionary**)'<br>
> videofecencoder.cc:(.text+0x1e2): undefined reference to<br>
> `av_image_alloc(unsigned char**, int*, int, int, PixelFormat, int)'<br>
> videofecencoder.cc:(.text+0x330): undefined reference to<br>
> `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)'<br>
> videofecencoder.cc:(.text+0x3b3): undefined reference to<br>
> `avcodec_encode_video(AVCodecContext*, unsigned char*, int, AVFrame const*)'<br>
> videofecencoder.cc:(.text+0x464): undefined reference to<br>
> `avcodec_close(AVCodecContext*)'<br>
> videofecencoder.cc:(.text+0x46f): undefined reference to `av_free(void*)'<br>
> videofecencoder.cc:(.text+0x47c): undefined reference to `av_free(void*)'<br>
> videofecencoder.cc:(.text+0x487): undefined reference to `av_free(void*)'<br>
> /tmp/ccDQpTY5.o: In function `main':<br>
> videofecencoder.cc:(.text+0x4a8): undefined reference to<br>
> `avcodec_register_all()'<br>
> collect2: ld returned 1 exit status<br>
><br>
> I have tried the same using two different Ubuntu-installations. The above<br>
> compilation was performed using OpenSUSE installed in a VirtualBox. I did<br>
> the above at a new installation of OpenSUSE. After installing it I<br>
> downloaded the required libraries using the libraries provided in the<br>
> Software repository called 'PackMan'.<br>
<br>
</div></div>You lack libraries' header files. Find and install packages that<br>
contain files /usr/include/libavformat/avformat.h,<br>
/usr/include/libavcodec/avcodec.h . I hope you got the point. I don't<br>
know exact package names for suse and ubuntu.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Andrey Utkin<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><div style="color:rgb(51,51,51)"><span style="border-collapse:collapse;color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px"><b>Kind regards,</b></span></div>
</span><span style="border-collapse:collapse;color:rgb(51,51,51);font-family:arial,sans-serif;font-size:13px"><img src="http://www.proofexistencegod.com/wp-content/uploads/2011/01/SignaturAndersBranderud60procent.jpg"></span><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><div style="color:rgb(51,51,51)">
<br></div><font color="#000099">[Personal blog] <a href="http://www.proofexistencegod.com/will-of-god/will-of-god/" target="_blank">Will of the Creator</a>  : 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.<br>
<br>[Company] Anders Branderud IT Solutions - <a href="http://www.abitsolutions.org/" target="_blank">www.abitsolutions.org</a></font></span><br>
</div>