用一个动词来静态记录OpenGL输出的动画
链接的avlib库,我按照以下步骤操作。
我已经从以下位置下载了libav-win32-20130921.7z文件
http://win32.libav.org/win32/并将所有文件解压缩到一个
文件夹(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文件。
在我的主头文件中,插入以下代码:
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")
}
在提供的项目设置中,其他包含目录
“ 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_ms 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:引用了未解析的外部符号___udivdi3
函数_nut_read_header libavformat.a(r3d.o):错误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文件复制到了debug floder(在其中创建了主要可执行文件),并如下更改了main标头:
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。
有人可以找出我在哪里犯任何错误吗?
潘妮
最佳答案
您需要libav项目的.lib和.dll文件。不幸的是,它们没有随libav一起交付,而是必须手动构建。
幸运的是,您可以从this页面下载它们。
.dll文件在共享包中(
存档)
.lib文件位于dev软件包(lib目录)中
关于c++ - 在Visual Studio 2008中链接libav库,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19057403/