没有找到 avformat-56.dll,因此这个应用程序未能启动。重新安装应用程序可能会修复此有关问题

没有找到 avformat-56.dll,因此这个应用程序未能启动。重新安装应用程序可能会修复此问题。
代码是:
#ifdef __cplusplus
extern "C" {
#endif
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>  
#ifdef __cplusplus
}
#endif

#pragma comment(lib, "ffmpeg-win32-dev\\lib\\avcodec.lib")
#pragma comment(lib, "ffmpeg-win32-dev\\lib\\avformat.lib")
#pragma comment(lib, "ffmpeg-win32-dev\\lib\\swscale.lib")

#include <stdio.h>
#include <string>
int main(){

AVFormatContext* pFormatCtx(NULL);  
std::string filename("a.avi");
int result = avformat_open_input(&pFormatCtx, filename.c_str(), NULL, NULL); 

return 0;
}

可以编译通过,但是运行的时候提示:

---------------------------
wtest.exe - 无法找到组件
---------------------------
没有找到 avformat-56.dll,因此这个应用程序未能启动。重新安装应用程序可能会修复此问题。 
---------------------------
确定   
---------------------------

提示:
直接用播放器可以正常打开文件a.avi,并播放的。

求助中!!!

------解决思路----------------------
本帖最后由 ccrun 于 2014-09-23 08:47:36 编辑
你这个代码中用到了FFmpeg库,那么编译的时候需要该库相应的头文件,链接的时候需要静态lib文件,而运行的时候需要相应的dll文件,这和直接用播放器能打开视频没什么关系。

建议你下载个FFmpeg编译好的库,需要哪些文件就复制到你可执行文件的输出目录中。
http://ffmpeg.zeranoe.com/builds/win32/shared/