I have cross compiled ffmpeg and libav from Linux to Windows (mingw32). So, I've got my .a files and ready to be used for linking in my MSVC2010 project. The thing is that I am getting linking errors and I don't understand why:

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)

Does anybody know what could happen?

有帮助吗?

解决方案 2

Finally I realized that Mingw compiled libs could not be linked from a VS2010 native application.

其他提示

You must use C style name mangling when including libav* headers.

extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavcodec/avcodec.h>
...
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top