gpt4 book ai didi

c++ - Windows 中的 ffmpeg/libav 链接问题

转载 作者:行者123 更新时间:2023-11-30 02:50:40 28 4
gpt4 key购买 nike

我已经将 ffmpeg 和 libav 从 Linux 交叉编译到 Windows (mingw32)。所以,我已经有了我的 .a 文件并准备好用于在我的 MSVC2010 项目中进行链接。问题是我收到链接错误,我不明白为什么:

1>RTSPCapture.obj : error LNK2019: unresolved external symbol _avformat_free_context referenced in function "public: int __thiscall Imagsa::RTSPCapture::dumpSync(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &,double *,class std::vector<class Imagsa::MjpegFrame,class std::allocator<class Imagsa::MjpegFrame> > &)" (?dumpSync@RTSPCapture@Imagsa@@QAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@4@PANAAV?$vector@VMjpegFrame@Imagsa@@V?$allocator@VMjpegFrame@Imagsa@@@std@@@4@@Z)
1>RTSPCapture.obj : error LNK2019: unresolved external symbol _avio_close referenced in function "public: int __thiscall Imagsa::RTSPCapture::dumpSync(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &,double *,class std::vector<class Imagsa::MjpegFrame,class std::allocator<class Imagsa::MjpegFrame> > &)" (?dumpSync@RTSPCapture@Imagsa@@QAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@4@PANAAV?$vector@VMjpegFrame@Imagsa@@V?$allocator@VMjpegFrame@Imagsa@@@std@@@4@@Z)
1>RTSPCapture.obj : error LNK2019: unresolved external symbol _avcodec_close referenced in function "public: int __thiscall Imagsa::RTSPCapture::dumpSync(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &,double *,class std::vector<class Imagsa::MjpegFrame,class std::allocator<class Imagsa::MjpegFrame> > &)" (?dumpSync@RTSPCapture@Imagsa@@QAEHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0AAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@4@PANAAV?$vector@VMjpegFrame@Imagsa@@V?$allocator@VMjpegFrame@Imagsa@@@std@@@4@@Z)

有人知道会发生什么吗?

最佳答案

在包含 libav* header 时,您必须使用 C 风格的名称修饰。

extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavcodec/avcodec.h>
...
}

关于c++ - Windows 中的 ffmpeg/libav 链接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20270795/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com