链接libavcodec和libavformat:未定义的引用

时间:2014-12-08 20:35:50

标签: c gcc ffmpeg undefined-reference

我正在尝试编译我正在使用ffmpeg库的项目。该项目用C语言编写。头文件适当地包含在源代码中。特别是,它似乎使用libavcodeclibavformat,并且这些库在Makefile中与LDFLAGS正确链接。以下是使用的标志:

-lavcodec -lavformat -lswscale -lavutil

现在,因为Ubuntu附带的打包库太过时,我下载了ffmpeg的最新源代码,编译并安装它。我删除了通过包管理器安装的所有打包库。现在,尽管添加了上面的标志,我得到了很多未定义的引用,我似乎无法解决它。以下是关于未定义引用的输出:

//usr/local/lib/libavcodec.a(cscd.o): In function `decode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/cscd.c:91: undefined reference to `uncompress'
//usr/local/lib/libavcodec.a(dxa.o): In function `decode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/dxa.c:250: undefined reference to `uncompress'
//usr/local/lib/libavcodec.a(exr.o): In function `pxr24_uncompress':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/exr.c:784: undefined reference to `uncompress'
//usr/local/lib/libavcodec.a(exr.o): In function `zip_uncompress':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/exr.c:259: undefined reference to `uncompress'
//usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_block':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:191: undefined reference to `inflateReset'
//usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv2_prime':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:158: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:160: undefined reference to `deflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:166: undefined reference to `deflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:167: undefined reference to `deflateEnd'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:169: undefined reference to `inflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:178: undefined reference to `inflate'
//usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_block':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:207: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:210: undefined reference to `inflateSync'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:211: undefined reference to `inflate'
//usr/local/lib/libavcodec.a(flashsv.o): In function `calc_deflate_block_size':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:259: undefined reference to `deflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:261: undefined reference to `deflateBound'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:262: undefined reference to `deflateEnd'
//usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_end':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:107: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv.c:126: undefined reference to `inflateInit_'
//usr/local/lib/libavcodec.a(flashsv2enc.o): In function `encode_zlib':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv2enc.c:354: undefined reference to `compress2'
//usr/local/lib/libavcodec.a(flashsv2enc.o): In function `encode_zlibprime':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv2enc.c:366: undefined reference to `deflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv2enc.c:375: undefined reference to `deflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv2enc.c:384: undefined reference to `deflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsv2enc.c:385: undefined reference to `deflateEnd'
//usr/local/lib/libavcodec.a(flashsvenc.o): In function `encode_bitstream':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsvenc.c:190: undefined reference to `compress2'
//usr/local/lib/libavcodec.a(flashsvenc.o): In function `flashsv_encode_end':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/flashsvenc.c:95: undefined reference to `deflateEnd'
//usr/local/lib/libavcodec.a(g2meet.o): In function `kempf_decode_tile':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/g2meet.c:408: undefined reference to `uncompress'
//usr/local/lib/libavcodec.a(lcldec.o): In function `zlib_decomp':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:137: undefined reference to `inflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:146: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:137: undefined reference to `inflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:146: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:137: undefined reference to `inflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:146: undefined reference to `inflate'
//usr/local/lib/libavcodec.a(lcldec.o): In function `decode_end':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:647: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(lcldec.o): In function `decode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lcldec.c:623: undefined reference to `inflateInit_'
//usr/local/lib/libavcodec.a(lclenc.o): In function `encode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lclenc.c:80: undefined reference to `deflateBound'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lclenc.c:90: undefined reference to `deflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lclenc.c:101: undefined reference to `deflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lclenc.c:107: undefined reference to `deflate'
//usr/local/lib/libavcodec.a(lclenc.o): In function `encode_end':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lclenc.c:184: undefined reference to `deflateEnd'
//usr/local/lib/libavcodec.a(lclenc.o): In function `encode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/lclenc.c:165: undefined reference to `deflateInit_'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_subpacket':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:376: undefined reference to `swr_is_initialized'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:222: undefined reference to `swr_is_initialized'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_init_resample':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:163: undefined reference to `swr_init'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:169: undefined reference to `swr_convert'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:236: undefined reference to `swr_convert'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_flush_resample':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:117: undefined reference to `swr_convert'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_subpacket':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:408: undefined reference to `swr_close'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_flush':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:563: undefined reference to `swr_close'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_close':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:585: undefined reference to `swr_free'
//usr/local/lib/libavcodec.a(opusdec.o): In function `opus_decode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/opusdec.c:638: undefined reference to `swr_alloc'
//usr/local/lib/libavcodec.a(pngdec.o): In function `decode_zbuf':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:425: undefined reference to `inflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:439: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:448: undefined reference to `inflateEnd'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:453: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(pngdec.o): In function `png_decode_idat':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:393: undefined reference to `inflate'
//usr/local/lib/libavcodec.a(pngdec.o): In function `decode_frame_apng':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:1179: undefined reference to `inflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:1203: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(pngdec.o): In function `decode_frame_png':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:1126: undefined reference to `inflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngdec.c:1142: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_chunk':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:200: undefined reference to `crc32'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:202: undefined reference to `crc32'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:205: undefined reference to `crc32'
//usr/local/lib/libavcodec.a(pngenc.o): In function `encode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:298: undefined reference to `deflateInit2_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:303: undefined reference to `deflateBound'
//usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_row':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:220: undefined reference to `deflate'
//usr/local/lib/libavcodec.a(pngenc.o): In function `encode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:447: undefined reference to `deflateEnd'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:422: undefined reference to `deflate'
//usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_row':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:220: undefined reference to `deflate'
//usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_chunk':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:200: undefined reference to `crc32'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/pngenc.c:202: undefined reference to `crc32'
//usr/local/lib/libavcodec.a(svq3.o): In function `svq3_decode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/svq3.c:1016: undefined reference to `uncompress'
//usr/local/lib/libavcodec.a(tiff.o): In function `tiff_uncompress':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tiff.c:329: undefined reference to `inflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tiff.c:334: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tiff.c:335: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(tiffenc.o): In function `encode_strip':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tiffenc.c:175: undefined reference to `compress'
//usr/local/lib/libavcodec.a(tscc.o): In function `decode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tscc.c:77: undefined reference to `inflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tscc.c:86: undefined reference to `inflate'
//usr/local/lib/libavcodec.a(tscc.o): In function `decode_end':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tscc.c:173: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(tscc.o): In function `decode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/tscc.c:155: undefined reference to `inflateInit_'
//usr/local/lib/libavcodec.a(zerocodec.o): In function `zerocodec_decode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zerocodec.c:56: undefined reference to `inflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zerocodec.c:79: undefined reference to `inflate'
//usr/local/lib/libavcodec.a(zerocodec.o): In function `zerocodec_decode_close':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zerocodec.c:109: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(zerocodec.o): In function `zerocodec_decode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zerocodec.c:127: undefined reference to `inflateInit_'
//usr/local/lib/libavcodec.a(zmbv.o): In function `decode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbv.c:486: undefined reference to `inflateReset'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbv.c:523: undefined reference to `inflate'
//usr/local/lib/libavcodec.a(zmbv.o): In function `decode_end':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbv.c:616: undefined reference to `inflateEnd'
//usr/local/lib/libavcodec.a(zmbv.o): In function `decode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbv.c:601: undefined reference to `inflateInit_'
//usr/local/lib/libavcodec.a(zmbvenc.o): In function `encode_frame':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbvenc.c:224: undefined reference to `deflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbvenc.c:215: undefined reference to `deflateReset'
//usr/local/lib/libavcodec.a(zmbvenc.o): In function `encode_end':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbvenc.c:259: undefined reference to `deflateEnd'
//usr/local/lib/libavcodec.a(zmbvenc.o): In function `encode_init':
/home/abhijitv/Downloads/ffmpeg-2.5/libavcodec/zmbvenc.c:321: undefined reference to `deflateInit_'
//usr/local/lib/libavformat.a(rtmpproto.o): In function `rtmp_uncompress_swfplayer':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/rtmpproto.c:1097: undefined reference to `inflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/rtmpproto.c:1107: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/rtmpproto.c:1125: undefined reference to `inflateEnd'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/rtmpproto.c:1125: undefined reference to `inflateEnd'
//usr/local/lib/libavformat.a(swfdec.o): In function `swf_read_packet':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/swfdec.c:335: undefined reference to `uncompress'
//usr/local/lib/libavformat.a(swfdec.o): In function `swf_read_header':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/swfdec.c:124: undefined reference to `inflateInit_'
//usr/local/lib/libavformat.a(swfdec.o): In function `zlib_refill':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/swfdec.c:92: undefined reference to `inflate'
//usr/local/lib/libavformat.a(swfdec.o): In function `swf_read_close':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/swfdec.c:502: undefined reference to `inflateEnd'
//usr/local/lib/libavformat.a(http.o): In function `http_close':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/http.c:1093: undefined reference to `inflateEnd'
//usr/local/lib/libavformat.a(http.o): In function `parse_content_encoding':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/http.c:419: undefined reference to `inflateEnd'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/http.c:420: undefined reference to `inflateInit2_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/http.c:425: undefined reference to `zlibCompileFlags'
//usr/local/lib/libavformat.a(http.o): In function `http_buf_read_compressed':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/http.c:902: undefined reference to `inflate'
//usr/local/lib/libavformat.a(id3v2.o): In function `id3v2_parse':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/id3v2.c:900: undefined reference to `uncompress'
//usr/local/lib/libavformat.a(matroskadec.o): In function `matroska_decode_buffer':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/matroskadec.c:1212: undefined reference to `inflateInit_'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/matroskadec.c:1227: undefined reference to `inflate'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/matroskadec.c:1220: undefined reference to `inflateEnd'
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/matroskadec.c:1232: undefined reference to `inflateEnd'
//usr/local/lib/libavformat.a(mov.o): In function `mov_read_cmov':
/home/abhijitv/Downloads/ffmpeg-2.5/libavformat/mov.c:3146: undefined reference to `uncompress'
collect2: error: ld returned 1 exit status

有谁可以解释这里出了什么问题,以及我如何解决这个问题?

1 个答案:

答案 0 :(得分:7)

你错过了一些图书馆 附加:

-lswresample -lm -lz