2013-11-28 77 views
1

我已經從Linux到Windows(mingw32)交叉編譯ffmpeg和libav。所以,我已經有了我的.a文件,並準備好用於我的MSVC2010項目中的鏈接。問題是我得到鏈接錯誤,我不明白爲什麼:ffmpeg/libav在Windows中鏈接問題

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> > &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@@[email protected]@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> > &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@@[email protected]@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> > &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@@[email protected]@Z) 

有人知道會發生什麼嗎?

回答

1

最後我意識到,Mingw編譯的庫不能從VS2010本機應用程序鏈接。

+0

我過去曾經鏈接過它們。 –

2

包含libav *頭文件時,您必須使用C風格名稱加密。

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

不夠。我正在使用.lib靜態庫。 –