Thanks Jeff. However, the header file of those C routines are included in ffmpegmgr.h, which is in turn included by ffmpegmgr.cpp.<br><br>The "undefined reference " normally indicates that the functions's definitions are not found, and it takes place when doing the linker. The libraries, libavcodec, etc, have been specified from the g++ command line, and seems to work - only that I need to make the encapulated member function in ffmpegmgr.cpp inline to eliminate the linker error:<br>
<br>inline void FFMpegMgr::new_video_stream(AVFormatContext *oc)<br>{<br> ...<br> st = av_new_stream(oc, oc->nb_streams);<br> ...<br>}<br><br>Also, the lib that I specified is *.a, will it be different if the lib is *.so ?<br>
<br>Thanks,<br>Hai<br><br><br><div class="gmail_quote">On Mon, Jun 7, 2010 at 1:26 AM, Jeff Newmiller <span dir="ltr"><<a href="mailto:jdnewmil@dcn.davis.ca.us">jdnewmil@dcn.davis.ca.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Seems more likely that you haven't included the declarations for the C routines in your cpp file. Would need to see more context to diagnose.<br>
<div><div></div><div class="h5"><br>
"Hai Yi" <<a href="mailto:yihai2004@gmail.com">yihai2004@gmail.com</a>> wrote:<br>
<br>
>Hello all:<br>
><br>
>I created a class FFMpegMgr and a method init(); inside init() I just put<br>
>three ffmpeg api there:<br>
>avcodec_register_all();<br>
>avdevice_register_all();<br>
> av_register_all();<br>
><br>
>The source file ffmpegmgr.cpp look like this:<br>
><br>
> void FFMpegMgr::init() {<br>
> avcodec_register_all();<br>
> avdevice_register_all();<br>
> av_register_all();<br>
><br>
>}<br>
><br>
>Now I got a "undefined reference to avcodec_register_all" error.<br>
><br>
>if I put that body in the class declaration or add a "inline" keyword, that<br>
>problem was gone and the compilation succeeded.<br>
><br>
>question is, do those three functions, which are C functions defined in<br>
>avcodec.h, have to be used only in the inline functions in C++?<br>
><br>
>Sorry if it appear naive - I've been out of touch with C/C++ for a while.<br>
><br>
>Thanks!<br>
>Hai<br>
</div></div><div class="im">>_______________________________________________<br>
>vox-tech mailing list<br>
><a href="mailto:vox-tech@lists.lugod.org">vox-tech@lists.lugod.org</a><br>
><a href="http://lists.lugod.org/mailman/listinfo/vox-tech" target="_blank">http://lists.lugod.org/mailman/listinfo/vox-tech</a><br>
<br>
</div>---------------------------------------------------------------------------<br>
<font color="#888888">Jeff Newmiller The ..... ..... Go Live...<br>
DCN:<<a href="mailto:jdnewmil@dcn.davis.ca.us">jdnewmil@dcn.davis.ca.us</a>> Basics: ##.#. ##.#. Live Go...<br>
Live: OO#.. Dead: OO#.. Playing<br>
Research Engineer (Solar/Batteries O.O#. #.O#. with<br>
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k<br>
---------------------------------------------------------------------------<br>
Sent from my phone. Please excuse my brevity.<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
vox-tech mailing list<br>
<a href="mailto:vox-tech@lists.lugod.org">vox-tech@lists.lugod.org</a><br>
<a href="http://lists.lugod.org/mailman/listinfo/vox-tech" target="_blank">http://lists.lugod.org/mailman/listinfo/vox-tech</a><br>
</div></div></blockquote></div><br>