[Libav-user] undefined reference to av_frame_alloc/free

wm4 nfxjfg at googlemail.com
Wed May 28 18:45:30 CEST 2014


On Wed, 28 May 2014 00:13:07 -0400
Jason Blum <jason.j.blum at gmail.com> wrote:

> Hello,
> 
> I am working on a catkin-built ROS c++ project. I am trying to link to
> whatever FFMPEG library is necessary to use the new av_frame_alloc( ) and
> av_frame_free( ) functions. The online documentation says it would be
> avutil/frame.h, but I still get undefined reference linking errors.
> 
> I am also linking to avcodec, avformat, and swscale, all of which seem to
> link just fine.
> 
> This is my ffmpeg version:
> ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
>   built on May  2 2014 21:57:13 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
>   configuration: --disable-stripping --enable-shared
>   libavutil      52. 66.101 / 52. 66.101
>   libavcodec     55. 52.102 / 55. 52.102
>   libavformat    55. 34.100 / 55. 34.100
>   libavdevice    55. 11.100 / 55. 11.100
>   libavfilter     4.  3.100 /  4.  3.100
>   libswscale      2.  5.101 /  2.  5.101
>   libswresample   0. 18.100 /  0. 18.100
> Hyper fast Audio and Video encoder
> usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
> outfile}...
> 
> These are the compile errors:
> CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function
> `h264_Decoder::h264_Decoder()':
> h264_decoder.cpp:(.text+0x19c): undefined reference to `av_frame_alloc'
> h264_decoder.cpp:(.text+0x1ac): undefined reference to `av_frame_alloc'
> CMakeFiles/h264_decoder_node.dir/src/h264_decoder.cpp.o: In function
> `h264_Decoder::~h264_Decoder()':
> h264_decoder.cpp:(.text+0x32e): undefined reference to `av_frame_free'
> h264_decoder.cpp:(.text+0x340): undefined reference to `av_frame_free'
> collect2: error: ld returned 1 exit status
> make[2]: ***
> [/home/jason/ROS/ARDrone/devel/lib/ardrone_2/h264_decoder_node] Error 1
> make[1]: *** [ardrone_2/CMakeFiles/h264_decoder_node.dir/all] Error 2
> make: *** [all] Error 2
> Invoking "make" failed
> 
> The headers I am #include'ing:
> extern "C" {
>     #include <libavcodec/avcodec.h>
>     #include <libswscale/swscale.h>
>     #include <libavformat/avformat.h>
>     #include <libavutil/avutil.h>
>     #include <libavutil/frame.h>
> }
> 
> What am I missing?

These functions were added in a recent release, so maybe your
installation is fucked up, and headers and library mismatch.


More information about the Libav-user mailing list