<div dir="ltr"><div class="gmail_extra">Wall of text incoming. Sorry if this is too long. Let me know and I will use a pastebin next time. Below the dashed lines is a series of compiling errors based on a sequence of adding and removing the ffmpeg linking flags in various ways to create a pattern. Some interesting things occur.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">1) The avutil "undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52'" switches to the normal looking "undefined reference to `av_frame_free'" if you include the avutil linking flag.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">2) When the avutil and swscale linking flags were both not included, the swscale undefined reference error did not appear. The "undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52'" was the only error shown.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">3) Aren't av_malloc( ) and av_free( ) from avutil as well?...reading documentation.....I see that avcodec.h includes the avutil/mem.h and avutil/frame.h headers...That explains why it complains about symbols in libavutil when I am just using avcodec. I didn't have to link to avutil directly before...Why does it make a difference now?</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">-----------------------------------------------------------------------------------------------------</div><div class="gmail_extra">-----------------------------------------------------------------------------------------------------</div>

<div class="gmail_extra">If I remove the linking flags for all the ffmpeg libraries, I get what I'd expect (lots of undefined reference errors, one for each function i tried to use):</div><div class="gmail_extra"><br>

</div><div class="gmail_extra"><div class="gmail_extra">Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node</div><div class="gmail_extra">CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::h264_Decoder()':</div>

<div class="gmail_extra">h264_decoder.cpp:(.text+0x82): undefined reference to `avcodec_register_all'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0x87): undefined reference to `av_register_all'</div><div class="gmail_extra">

h264_decoder.cpp:(.text+0x91): undefined reference to `avcodec_find_decoder'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0xc1): undefined reference to `avcodec_alloc_context3'</div><div class="gmail_extra">

h264_decoder.cpp:(.text+0xf2): undefined reference to `avcodec_open2'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0x19c): undefined reference to `av_frame_alloc'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0x1ac): undefined reference to `av_frame_alloc'</div>

<div class="gmail_extra">h264_decoder.cpp:(.text+0x1d7): undefined reference to `avpicture_get_size'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0x1e7): undefined reference to `av_malloc'</div><div class="gmail_extra">

h264_decoder.cpp:(.text+0x231): undefined reference to `avpicture_fill'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0x29f): undefined reference to `sws_getCachedContext'</div><div class="gmail_extra">CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::~h264_Decoder()':</div>

<div class="gmail_extra">h264_decoder.cpp:(.text+0x31c): undefined reference to `av_free'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0x32e): undefined reference to `av_frame_free'</div><div class="gmail_extra">

h264_decoder.cpp:(.text+0x340): undefined reference to `av_frame_free'</div><div class="gmail_extra">h264_decoder.cpp:(.text+0x353): undefined reference to `sws_freeContext'</div><div class="gmail_extra">collect2: error: ld returned 1 exit status</div>

<div class="gmail_extra">make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1</div><div class="gmail_extra">make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2</div><div class="gmail_extra">

make: *** [all] Error 2</div><div class="gmail_extra">Invoking "make" failed</div><div><br></div></div><div class="gmail_extra"><div>Including avcodec and avformat linking flags (still not including swscale) changes this to:</div>

<div><br></div><div><div>Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node</div><div>[  4%] Built target video_client_node</div><div>[ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus</div>

<div>/usr/bin/ld: CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52'</div><div>//usr/local/lib/libavutil.so.52: error adding symbols: DSO missing from command line</div>

<div>collect2: error: ld returned 1 exit status</div><div>make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1</div><div>make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2</div>

<div>make: *** [all] Error 2</div><div>Invoking "make" failed</div></div><div><br></div><div>Then including avutil flags (still not including swscale):</div><div><br></div><div><div>Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node</div>

<div>Built target genmsg_eus</div><div>[  1%] Built target navdata_client_node</div><div>[  3%] [  4%] Built target video_client_node</div><div>Built target at_controller_node</div><div>[ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus</div>

<div>CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::h264_Decoder()':</div><div>h264_decoder.cpp:(.text+0x19c): undefined reference to `av_frame_alloc'</div><div>h264_decoder.cpp:(.text+0x1ac): undefined reference to `av_frame_alloc'</div>

<div>h264_decoder.cpp:(.text+0x29f): undefined reference to `sws_getCachedContext'</div><div>CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::~h264_Decoder()':</div><div>h264_decoder.cpp:(.text+0x32e): undefined reference to `av_frame_free'</div>

<div>h264_decoder.cpp:(.text+0x340): undefined reference to `av_frame_free'</div><div>h264_decoder.cpp:(.text+0x353): undefined reference to `sws_freeContext'</div><div>collect2: error: ld returned 1 exit status</div>

<div>make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1</div><div>make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2</div><div>make: *** [all] Error 2</div><div>Invoking "make" failed</div>

</div><div><br></div><div>And finally including swscale flag:</div><div><br></div><div><div>Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node</div><div>[  0%] Built target genmanifest_eus</div>

<div>[  1%] [  3%] [  4%] Built target video_client_node</div><div>Built target at_controller_node</div><div>Built target navdata_client_node</div><div>[ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus</div><div>CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::h264_Decoder()':</div>

<div>h264_decoder.cpp:(.text+0x19c): undefined reference to `av_frame_alloc'</div><div>h264_decoder.cpp:(.text+0x1ac): undefined reference to `av_frame_alloc'</div><div>CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function `h264_Decoder::~h264_Decoder()':</div>

<div>h264_decoder.cpp:(.text+0x32e): undefined reference to `av_frame_free'</div><div>h264_decoder.cpp:(.text+0x340): undefined reference to `av_frame_free'</div><div>collect2: error: ld returned 1 exit status</div>

<div>make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1</div><div>make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2</div><div>make: *** [all] Error 2</div><div>Invoking "make" failed</div>

</div><div><br></div><div>Now, keeping avcodec, avformat, and swscale flags, but removing avutil flags again:</div><div><div>Linking CXX executable /home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node</div><div>
[  1%] [  4%] [  4%] Built target video_client_node</div>
<div>Built target navdata_client_node</div><div>Built target at_controller_node</div><div>[ 98%] Built target ardrone_2_ALL_GEN_OUTPUT_FILES_eus</div><div>/usr/bin/ld: CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: undefined reference to symbol 'av_frame_free@@LIBAVUTIL_52'</div>

<div>//usr/local/lib/libavutil.so.52: error adding symbols: DSO missing from command line</div><div>collect2: error: ld returned 1 exit status</div><div>make[2]: *** [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1</div>

<div>make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2</div><div>make: *** [all] Error 2</div><div>Invoking "make" failed</div></div><div><br></div><div>Commenting out any use of avutil functions: av_alloc_frame( ), av_frame_free( ), av_malloc( ), and av_free( ) in my code:</div>

<div>No errors.</div><div><br></div><div>Add avutil linking flag again, then uncomment av_malloc( ) and av_free( ):</div><div>No errors.</div></div></div>