Visual Studio下程序开发: error LNK2019: 无法解析的外部符号

一、环境介绍

 Visual Studio IDE 版本:  VS2017

QT版本: QT5.12.6

产生问题环境:  在Visual Studio 2017下开发QT程序,引用了ffmpeg库实现视频播放器开发。

error LNK2019: 无法解析的外部符号
error LNK2001: 无法解析的外部符号

1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _avformat_alloc_output_context2,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>VideoEncode.obj : error LNK2001: 无法解析的外部符号 _avformat_alloc_output_context2
1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _avformat_open_input,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>CDecodeAudio.obj : error LNK2001: 无法解析的外部符号 _avformat_open_input
1>KFileDecoders.obj : error LNK2001: 无法解析的外部符号 _avformat_open_input
1>VideoEncode.obj : error LNK2001: 无法解析的外部符号 _avformat_open_input
1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _av_read_frame,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>CDecodeAudio.obj : error LNK2001: 无法解析的外部符号 _av_read_frame
1>KFileDecoders.obj : error LNK2001: 无法解析的外部符号 _av_read_frame
1>VideoEncode.obj : error LNK2001: 无法解析的外部符号 _av_read_frame
1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _av_seek_frame,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>KFileDecoders.obj : error LNK2001: 无法解析的外部符号 _av_seek_frame
1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _avformat_close_input,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>CDecodeAudio.obj : error LNK2001: 无法解析的外部符号 _avformat_close_input
1>KFileDecoders.obj : error LNK2001: 无法解析的外部符号 _avformat_close_input
1>VideoEncode.obj : error LNK2001: 无法解析的外部符号 _avformat_close_input
1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _avformat_write_header,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>VideoEncode.obj : error LNK2001: 无法解析的外部符号 _avformat_write_header
1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _av_interleaved_write_frame,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>VideoEncode.obj : error LNK2001: 无法解析的外部符号 _av_interleaved_write_frame
1>CClipVideo.obj : error LNK2019: 无法解析的外部符号 _av_write_trailer,该符号在函数 "protected: int __thiscall CClipVideo::ClipVideo(void)" (?ClipVideo@CClipVideo@@IAEHXZ) 中被引用
1>VideoEncode.obj : error LNK2001: 无法解析的外部符号 _av_write_trailer

二、解决问题

出现问题的情况, 一般是在工程里引用了外置库的相关函数,在链接里没有指定库的路径或者是定义函数的.cpp文件没有加入到工程中。

如果是因为引用了外置的库,并用到了外置库里函数,没有加链接路径,那么按照下图把使用的库加入到附加依赖项里即可。

猜你喜欢

转载自blog.csdn.net/xiaolong1126626497/article/details/112868444
今日推荐