0

以静态方式记录OpenGL输出的动画

链接的 avlib 库我遵循以下步骤。

  1. 我已经从http://win32.libav.org/win32/下载了 libav-win32-20130921.7z 文件, 并将所有文件解压缩到一个文件夹中(d:/VC Projects/libav/)。lib 子文件夹包含所有 .a 文件(libavcodec.a、libavdevice.a、libavfilter.a、libavformat.a、libavresample.a、libavutil.a、libswscale.a 和 libavcodec.dll.a、libavdevice.dll。 a、libavfilter.dll.a、libavformat.dll.a、libavresample.dll.a、libavutil.dll.a、libswscale.dll.a) 以及 7 个 .def 文件。

  2. 在我的主头文件中,我插入了以下代码:

extern "C" 
{
#include <stdint.h>
#include <libavcodec/avcodec.h>
#include <libavfilter/avfilter.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfilter.h>
#include <libavresample/avresample.h>
#include <libavutil/avutil.h>
#include <libswscale/swscale.h>

#pragma comment(lib, "D:/VC Projects/libav/lib/libavutil.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libswscale.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavfilter.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavresample.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavcodec.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavdevice.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavformat.a")
}
  1. 在提供的项目设置中,附加包含目录“D:\VC Projects\libav\include”

当我编译项目时,我收到 316 个错误和 31 个警告:

> libavcodec.a(pthread.o) : warning LNK4217: locally defined symbol
> __beginthreadex imported in function _ff_thread_init libavutil.a(avstring.o) : warning LNK4049: locally defined symbol
> __vsnprintf imported libavformat.a(aviobuf.o) : warning LNK4217: locally defined symbol __vsnprintf imported in function _avio_printf
> libavformat.a(rtpproto.o) : warning LNK4049: locally defined symbol
> __vsnprintf imported libavformat.a(url.o) : warning LNK4049: locally defined symbol __vsnprintf imported libavutil.a(log.o) : warning
> LNK4049: locally defined symbol __vsnprintf imported
> libavformat.a(mov.o) : warning LNK4217: locally defined symbol
> __gmtime64 imported in function _mov_read_mdhd libavformat.a(mxfenc.o) : warning LNK4217: locally defined symbol __gmtime64 imported in
> function _mxf_write_header libavformat.a(wtv.o) : warning LNK4217:
> locally defined symbol __gmtime64 imported in function
> _parse_media_type libavutil.a(parseutils.o) : warning LNK4049: locally defined symbol __gmtime64 imported libavformat.a(os_support.o) :
> warning LNK4049: locally defined symbol __errno imported
> libavutil.a(file_open.o) : warning LNK4049: locally defined symbol
> __errno imported libavformat.a(rtsp.o) : warning LNK4217: locally defined symbol __errno imported in function
> _udp_read_packet.constprop.5 libavformat.a(file.o) : warning LNK4049: locally defined symbol __errno imported libavformat.a(md5proto.o) :
> warning LNK4049: locally defined symbol __errno imported
> libavformat.a(network.o) : warning LNK4049: locally defined symbol
> __errno imported libavformat.a(file.o) : warning LNK4217: locally defined symbol __stat64 imported in function _file_check
> libavformat.a(md5proto.o) : warning LNK4217: locally defined symbol
> __iob imported in function _md5_close libavutil.a(log.o) : warning LNK4217: locally defined symbol __iob imported in function
> _av_log_default_callback libavutil.a(parseutils.o) : warning LNK4217: locally defined symbol __time64 imported in function _av_parse_time
> libavutil.a(parseutils.o) : warning LNK4217: locally defined symbol
> __mktime64 imported in function _av_parse_time libavutil.a(parseutils.o) : warning LNK4217: locally defined symbol
> __localtime64 imported in function _av_parse_time libavutil.a(file_open.o) : warning LNK4217: locally defined symbol
> __wsopen imported in function _avpriv_open libavutil.a(file_open.o) : warning LNK4217: locally defined symbol __sopen imported in function
> _avpriv_open libavformat.a(riffenc.o) : error LNK2001: unresolved external symbol ___divdi3 libavutil.a(mathematics.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavutil.a(rational.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavformat.a(xa.o) :
> error LNK2001: unresolved external symbol ___divdi3
> libavformat.a(xwma.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavformat.a(yop.o) : error LNK2001: unresolved external symbol ___divdi3 libavformat.a(cutils.o) : error LNK2001: unresolved
> external symbol ___divdi3 libavformat.a(rmdec.o) : error LNK2019:
> unresolved external symbol ___divdi3 referenced in function
> _rm_read_header libavformat.a(rtpenc.o) : error LNK2001: unresolved external symbol ___divdi3 libavformat.a(rtspdec.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavformat.a(wtv.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavformat.a(nutenc.o)
> : error LNK2001: unresolved external symbol ___divdi3
> libavformat.a(nutdec.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavformat.a(pcmdec.o) : error LNK2001: unresolved external symbol ___divdi3 libavformat.a(rawvideodec.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavformat.a(mpegtsenc.o) :
> error LNK2001: unresolved external symbol ___divdi3
> libavformat.a(mpegts.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavformat.a(mxfdec.o) : error LNK2001: unresolved external symbol ___divdi3 libavformat.a(nsvdec.o) : error LNK2001: unresolved
> external symbol ___divdi3 libavformat.a(mmf.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavformat.a(mov.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavformat.a(mpc8.o) :
> error LNK2001: unresolved external symbol ___divdi3
> libavformat.a(mpegenc.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavformat.a(filmstripdec.o) : error LNK2001: unresolved external symbol ___divdi3 libavformat.a(flvenc.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavformat.a(gsmdec.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavformat.a(iss.o) :
> error LNK2001: unresolved external symbol ___divdi3
> libavformat.a(dvenc.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavformat.a(dv.o) : error LNK2001: unresolved external symbol ___divdi3 libavformat.a(dxa.o) : error LNK2001: unresolved
> external symbol ___divdi3 libavformat.a(ffmdec.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavformat.a(avienc.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavformat.a(avidec.o)
> : error LNK2001: unresolved external symbol ___divdi3
> libavformat.a(swfenc.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavformat.a(cafdec.o) : error LNK2001: unresolved external symbol ___divdi3 libavformat.a(adxdec.o) : error LNK2001: unresolved
> external symbol ___divdi3 libavformat.a(aiffenc.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavformat.a(asfenc.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavformat.a(asfdec.o)
> : error LNK2001: unresolved external symbol ___divdi3
> libavcodec.a(error_resilience.o) : error LNK2001: unresolved external
> symbol ___divdi3 libavcodec.a(iirfilter.o) : error LNK2001: unresolved
> external symbol ___divdi3 libavformat.a(mux.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavformat.a(utils.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavcodec.a(wmaenc.o) :
> error LNK2001: unresolved external symbol ___divdi3
> libavcodec.a(xsubenc.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavcodec.a(libvpxenc.o) : error LNK2001: unresolved external symbol ___divdi3 libavcodec.a(ituh263enc.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavcodec.a(mpeg4videodec.o) :
> error LNK2001: unresolved external symbol ___divdi3
> libavcodec.a(ac3enc_fixed.o) : error LNK2001: unresolved external
> symbol ___divdi3 libavcodec.a(mpegaudiodec.o) : error LNK2001:
> unresolved external symbol ___divdi3
> libavcodec.a(mpegaudiodec_float.o) : error LNK2001: unresolved
> external symbol ___divdi3 libavcodec.a(h261enc.o) : error LNK2001:
> unresolved external symbol ___divdi3 libavcodec.a(mpegvideo_enc.o) :
> error LNK2001: unresolved external symbol ___divdi3
> libavcodec.a(mpeg12enc.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavcodec.a(mpeg4videoenc.o) : error LNK2001: unresolved external symbol ___divdi3 libswscale.a(utils.o) : error LNK2001:
> unresolved external symbol ___divdi3 libswscale.a(yuv2rgb.o) : error
> LNK2001: unresolved external symbol ___divdi3 libavcodec.a(ffv1enc.o)
> : error LNK2001: unresolved external symbol ___divdi3
> libavcodec.a(flvenc.o) : error LNK2001: unresolved external symbol
> ___divdi3 libavutil.a(avstring.o) : error LNK2001: unresolved external symbol _snprintf libavutil.a(error.o) : error LNK2001: unresolved
> external symbol _snprintf libavutil.a(log.o) : error LNK2001:
> unresolved external symbol _snprintf libavutil.a(opt.o) : error
> LNK2001: unresolved external symbol _snprintf
> libavutil.a(channel_layout.o) : error LNK2001: unresolved external
> symbol _snprintf libavutil.a(samplefmt.o) : error LNK2001: unresolved
> external symbol _snprintf libavformat.a(id3v2.o) : error LNK2001:
> unresolved external symbol _snprintf libavformat.a(id3v1.o) : error
> LNK2001: unresolved external symbol _snprintf
> libavformat.a(httpauth.o) : error LNK2001: unresolved external symbol
> _snprintf libavutil.a(pixdesc.o) : error LNK2001: unresolved external symbol _snprintf libavformat.a(md5proto.o) : error LNK2001: unresolved
> external symbol _snprintf libavformat.a(rtpproto.o) : error LNK2001:
> unresolved external symbol _snprintf libavformat.a(tcp.o) : error
> LNK2001: unresolved external symbol _snprintf libavformat.a(udp.o) :
> error LNK2001: unresolved external symbol _snprintf
> libavformat.a(gopher.o) : error LNK2001: unresolved external symbol
> _snprintf libavformat.a(http.o) : error LNK2001: unresolved external symbol _snprintf libavformat.a(mmsh.o) : error LNK2001: unresolved
> external symbol _snprintf libavformat.a(mmst.o) : error LNK2001:
> unresolved external symbol _snprintf libavformat.a(vqf.o) : error
> LNK2001: unresolved external symbol _snprintf libavformat.a(wavdec.o)
> : error LNK2001: unresolved external symbol _snprintf
> libavformat.a(wtv.o) : error LNK2001: unresolved external symbol
> _snprintf libavformat.a(yuv4mpeg.o) : error LNK2001: unresolved external symbol _snprintf libavformat.a(mpjpeg.o) : error LNK2001:
> unresolved external symbol _snprintf libavformat.a(rtsp.o) : error
> LNK2019: unresolved external symbol _snprintf referenced in function
> _ff_rtsp_connect libavformat.a(rtspdec.o) : error LNK2001: unresolved external symbol _snprintf libavformat.a(smoothstreamingenc.o) : error
> LNK2001: unresolved external symbol _snprintf libavformat.a(movenc.o)

…………

错误 LNK2001:无法解析的外部符号 _snprintf libavcodec.a(ass.o):错误 LNK2001:无法解析的外部符号 _snprintf libavformat.a(utils.o):错误 LNK2001:无法解析的外部符号 _snprintf libavcodec.a(pnmenc.o):错误 LNK2001 : 无法解析的外部符号 _snprintf libavcodec.a(xbmenc.o) : 错误 LNK2001: 无法解析的外部符号 _snprintf libavcodec.a(srtdec.o) : 错误 LNK2001: 无法解析的外部符号 _snprintf libavcodec.a(xsubenc.o) : 错误 LNK2001: 无法解析外部符号 _snprintf libavcodec.a(utils.o):错误 LNK2001:未解析的外部符号 _snprintf libavcodec.a(ffv1enc.o):错误 LNK2001:未解析的外部符号 _snprintf libavcodec.a(huffyuvenc.o):错误 LNK2001:未解析的外部符号_snprintf libavcodec.a(pamenc.o):错误 LNK2001:未解析的外部符号snprintf libavformat.a(rtpproto.o):错误 LNK2019:未解析的外部符号 __rtp_write libavformat.a(smoothstreamingenc.o) 函数中引用的 _chkstk_ms:错误 LNK2001:未解析的外部符号 ___chkstk_ms libavformat.a(wtv.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavformat.a(gopher.o):错误 LNK2001:未解析外部符号 ___chkstk_ms libavformat.a(http.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavformat.a(rtsp.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavformat.a(rtspenc.o):错误 LNK2001:未解析的外部符号___chkstk_ms libavformat.a(rtspdec.o):错误 LNK2001:无法解析的外部符号 ___chkstk_ms libavformat.a(sapdec.o):错误 LNK2001:无法解析的外部符号 ___chkstk_ms libavcodec.a(mpegaudiodsp.o):错误 LNK2001:无法解析的外部符号 ___chkstk_ms libavformat .a(aviobuf.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavformat.a(hls.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavformat.a(mpegts.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavcodec.a(aaccoder.o):错误 LNK2001:未解析的外部符号符号___chkstk_ms libavcodec.a(kbdwin.o):错误LNK2001:无法解析的外部符号___chkstk_ms libavcodec.a(aacpsy.o):错误LNK2001:无法解析的外部符号___chkstk_ms libavcodec.a(aacps.o):错误LNK2001:无法解析的外部符号___chkstk_ms libavcodec.a(mpegvideo.o) : 错误 LNK2001: 无法解析的外部符号 .......... libavcodec.a(jpeg2000dec.o) : 错误 LNK2001: 无法解析的外部符号 ___chkstk_ms libavcodec.a(jpeglsenc.o) :错误 LNK2001:无法解析的外部符号 ___chkstk_ms libavcodec.a(svq1enc.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavcodec.a(utvideoenc.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavcodec.a(huffyuvdec.o):错误 LNK2001:未解析的外部符号 ___chkstk_ms libavcodec.a(4xm.o):错误 LNK2001:未解析的外部符号符号___chkstk_ms libavcodec.a(fraps.o):错误LNK2001:未解析的外部符号___chkstk_ms libavcodec.a(mpegvideo_enc.o):错误LNK2001:未解析的外部符号___chkstk_ms libavcodec.a(dnxhdenc.o):错误LNK2001:未解析的外部符号___chkstk libavcodec.a(dv.o):错误 LNK2001:无法解析的外部符号 ___chkstk_ms libavcodec.a(dvdec.o):错误 LNK2001:无法解析的外部符号 ___chkstk_ms libavcodec.a(ffv1enc.o):错误 LNK2001:无法解析的外部符号 ___chkstk_ms libavformat。 a(xwma.o):错误 LNK2001:未解析的外部符号__udivdi3 libavformat.a(oggparseogm.o):错误LNK2001:无法解析的外部符号_ _udivdi3 libavformat.a(nutdec.o):错误LNK2019:函数_nut_read_header libavformat.a(r3d.o)中引用的无法解析的外部符号___udivdi3:错误LNK2001:未解析的外部符号__ udivdi3 libavformat.a(tty.o)​​:错误LNK2001:未解析的外部符号_ _udivdi3 libavformat.a(wavdec.o)

> referenced in function _mp3lame_encode_init libavcodec.a(libmp3lame.o)
> : error LNK2019: unresolved external symbol _lame_get_encoder_delay
> referenced in function _mp3lame_encode_init libavcodec.a(libmp3lame.o)
> : error LNK2019: unresolved external symbol _lame_get_framesize
> referenced in function _mp3lame_encode_init libavcodec.a(libmp3lame.o)
> : error LNK2019: unresolved external symbol _lame_encode_buffer_float
> referenced in function _mp3lame_encode_frame
> libavcodec.a(libmp3lame.o) : error LNK2019: unresolved external symbol
> _lame_encode_buffer referenced in function _mp3lame_encode_frame libavcodec.a(libmp3lame.o) : error LNK2019: unresolved external symbol
> _lame_encode_buffer_int referenced in function _mp3lame_encode_frame libavcodec.a(libmp3lame.o) : error LNK2019: unresolved external symbol
> _lame_encode_flush referenced in function _mp3lame_encode_frame libavcodec.a(libvo-aacenc.o) : error LNK2019: unresolved external
> symbol _cmnMemAlloc referenced in function _aac_encode_init
> libavcodec.a(libvo-aacenc.o) : error LNK2019: unresolved external
> symbol _cmnMemCopy referenced in function _aac_encode_init
> libavcodec.a(libvo-aacenc.o) : error LNK2019: unresolved external
> symbol _cmnMemFree referenced in function _aac_encode_init
> libavcodec.a(libvo-aacenc.o) : error LNK2019: unresolved external
> symbol _cmnMemSet referenced in function _aac_encode_init
> libavcodec.a(libvo-aacenc.o) : error LNK2019: unresolved external
> symbol _cmnMemCheck referenced in function _aac_encode_init
> libavcodec.a(libvo-aacenc.o) : error LNK2019: unresolved external
> symbol _voGetAACEncAPI referenced in function _aac_encode_init
> libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_analysis_wrote referenced in function _oggvorbis_encode_frame libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_block_clear referenced in function _oggvorbis_encode_close libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_dsp_clear referenced in function _oggvorbis_encode_close libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_info_clear referenced in function _oggvorbis_encode_close libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_analysis_buffer referenced in function _oggvorbis_encode_frame libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_analysis_blockout referenced in function _oggvorbis_encode_frame libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol _vorbis_analysis referenced in function
> _oggvorbis_encode_frame libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol _vorbis_bitrate_addblock referenced in
> function _oggvorbis_encode_frame libavcodec.a(libvorbis.o) : error
> LNK2019: unresolved external symbol _vorbis_bitrate_flushpacket
> referenced in function _oggvorbis_encode_frame
> libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_info_init referenced in function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_encode_setup_vbr referenced in function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_encode_setup_managed referenced in function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol _vorbis_encode_ctl referenced in function
> _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol _vorbis_encode_setup_init referenced in
> function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error
> LNK2019: unresolved external symbol _vorbis_analysis_init referenced
> in function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error
> LNK2019: unresolved external symbol _vorbis_block_init referenced in
> function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error
> LNK2019: unresolved external symbol _vorbis_comment_init referenced in
> function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error
> LNK2019: unresolved external symbol _vorbis_comment_add_tag referenced
> in function _oggvorbis_encode_init libavcodec.a(libvorbis.o) : error
> LNK2019: unresolved external symbol _vorbis_analysis_headerout
> referenced in function _oggvorbis_encode_init
> libavcodec.a(libvorbis.o) : error LNK2019: unresolved external symbol
> _vorbis_comment_clear referenced in function _oggvorbis_encode_init libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol
> _vpx_codec_vp8_cx_algo referenced in function _vp8_init libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol
> _vpx_codec_error referenced in function _log_encoder_error libavcodec.a(libvpxdec.o) : error LNK2001: unresolved external symbol
> _vpx_codec_error libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol _vpx_codec_error_detail referenced in function
> _log_encoder_error libavcodec.a(libvpxdec.o) : error LNK2001: unresolved external symbol _vpx_codec_error_detail
> libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol
> _vpx_codec_control_ referenced in function _codecctl_int libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol
> _vpx_codec_destroy referenced in function _vp8_free libavcodec.a(libvpxdec.o) : error LNK2001: unresolved external symbol
> _vpx_codec_destroy libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol _vpx_codec_version_str referenced in
> function _vp8_init libavcodec.a(libvpxdec.o) : error LNK2001:
> unresolved external symbol _vpx_codec_version_str
> libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol
> _vpx_codec_build_config referenced in function _vp8_init libavcodec.a(libvpxdec.o) : error LNK2001: unresolved external symbol
> _vpx_codec_build_config libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol _vpx_codec_enc_config_default referenced in
> function _vp8_init libavcodec.a(libvpxenc.o) : error LNK2019:
> unresolved external symbol _vpx_codec_err_to_string referenced in
> function _vp8_init libavcodec.a(libvpxenc.o) : error LNK2019:
> unresolved external symbol _vpx_codec_enc_init_ver referenced in
> function _vp8_init libavcodec.a(libvpxenc.o) : error LNK2019:
> unresolved external symbol _vpx_img_wrap referenced in function
> _vp8_init libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol _vpx_codec_encode referenced in function _vp8_encode
> libavcodec.a(libvpxenc.o) : error LNK2019: unresolved external symbol
> _vpx_codec_get_cx_data referenced in function _vp8_encode libavcodec.a(libvpxdec.o) : error LNK2019: unresolved external symbol
> _vpx_codec_vp8_dx_algo referenced in function _vp8_init libavcodec.a(libvpxdec.o) : error LNK2019: unresolved external symbol
> _vpx_codec_decode referenced in function _vp8_decode libavcodec.a(libvpxdec.o) : error LNK2019: unresolved external symbol
> _vpx_codec_get_frame referenced in function _vp8_decode libavcodec.a(libvpxdec.o) : error LNK2019: unresolved external symbol
> _vpx_codec_dec_init_ver referenced in function _vp8_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_bit_depth referenced in function _X264_frame libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_encoder_close referenced in function _X264_close libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_param_default referenced in function _X264_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_param_default_preset referenced in function _X264_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_param_parse referenced in function _X264_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_param_apply_fastfirstpass referenced in function _X264_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_param_apply_profile referenced in function _X264_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_encoder_open_125 referenced in function _X264_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_encoder_headers referenced in function _X264_init libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_picture_init referenced in function _X264_frame libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_encoder_reconfig referenced in function _X264_frame libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_encoder_encode referenced in function _X264_frame libavcodec.a(libx264.o) : error LNK2019: unresolved external symbol
> _x264_encoder_delayed_frames referenced in function _X264_frame libavcodec.a(aacsbr.o) : error LNK2019: unresolved external symbol
> _exp2f referenced in function _ff_sbr_apply libavcodec.a(acelp_pitch_delay.o) : error LNK2001: unresolved external
> symbol _exp2f libavcodec.a(aacpsy.o) : error LNK2019: unresolved
> external symbol _atanf referenced in function _calc_bark
> libavcodec.a(aacps.o) : error LNK2001: unresolved external symbol
> _atanf libavformat.a(smoothstreamingenc.o) : error LNK2019: unresolved external symbol __imp___mkdir referenced in function _ism_write_header
> libavformat.a(wavenc.o) : error LNK2019: unresolved external symbol
> _strtoll referenced in function _wav_write_header libavformat.a(http.o) : error LNK2001: unresolved external symbol
> _strtoll libavutil.a(channel_layout.o) : error LNK2001: unresolved external symbol _strtoll libavformat.a(file.o) : error LNK2019:
> unresolved external symbol __imp___fstat64 referenced in function
> _file_seek libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol _RTMP_Socket referenced in function
> _rtmp_get_file_handle libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol _RTMP_SendSeek referenced in function
> _rtmp_read_seek libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol _RTMP_Pause referenced in function _rtmp_read_pause
> libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol
> _RTMP_Close referenced in function _rtmp_close libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol
> _RTMP_Write referenced in function _rtmp_write libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol
> _RTMP_Read referenced in function _rtmp_read libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol _RTMP_LogSetLevel
> referenced in function _rtmp_open libavformat.a(librtmp.o) : error
> LNK2019: unresolved external symbol _RTMP_LogSetCallback referenced in
> function _rtmp_open libavformat.a(librtmp.o) : error LNK2019:
> unresolved external symbol _RTMP_Init referenced in function
> _rtmp_open libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol _RTMP_SetupURL referenced in function _rtmp_open
> libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol
> _RTMP_Connect referenced in function _rtmp_open libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol
> _RTMP_ConnectStream referenced in function _rtmp_open libavformat.a(librtmp.o) : error LNK2019: unresolved external symbol
> _RTMP_EnableWrite referenced in function _rtmp_open libavutil.a(parseutils.o) : error LNK2019: unresolved external symbol
> ___strtod referenced in function _av_parse_color libavutil.a(eval.o) : error LNK2001: unresolved external symbol ___strtod
> libavutil.a(eval.o) : error LNK2019: unresolved external symbol _trunc
> referenced in function _eval_expr libavutil.a(time.o) : error LNK2019:
> unresolved external symbol _gettimeofday referenced in function
> _av_gettime libavutil.a(time.o) : error LNK2019: unresolved external symbol _usleep referenced in function _av_usleep

为了使用动态链接,我将所有 .dll 文件复制到调试文件(创建主可执行文件的位置)并更改了主标题,如下所示:

extern "C" 
{
#include <stdint.h>
#include <libavcodec/avcodec.h>
#include <libavfilter/avfilter.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfilter.h>
#include <libavresample/avresample.h>
#include <libavutil/avutil.h>
#include <libswscale/swscale.h>

#pragma comment(lib, "D:/VC Projects/libav/lib/libavutil.dll.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libswscale.dll.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavfilter.dll.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavresample.dll.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavcodec.dll.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavdevice.dll.a")
#pragma comment(lib, "D:/VC Projects/libav/lib/libavformat.dll.a")
}

该项目编译没有任何错误。但在执行时显示错误消息“过程入口点 sws_getContext 无法位于动态链接库 avutil-52.dll 中”并退出。

我链接静态库的第一个目标失败了,动态链接也失败了。

我使用的是 Visual Studio 2008,操作系统是 Windows XP。

有人可以弄清楚我在哪里犯了任何错误吗?

帕尼。

4

2 回答 2

1

您需要 libav 项目的 .lib 和 .dll 文件。不幸的是,它们没有随 libav 一起交付,而是必须手动构建。

幸运的是,您可以从此页面下载它们

  • .dll 文件位于共享包中(存档中的 bin 目录)
  • .lib 文件位于开发包(lib 目录)中
于 2014-01-16T15:05:00.177 回答
1

好吧,我想我找到了解决方案。您必须链接到 swscale.lib、avutil.lib 等文件。libx.dll.a 文件并不总是与 MSVC 一起正常工作。

于 2014-05-12T08:34:29.623 回答