<分区>
我刚刚下载了 ffmpeg 的开发包,并正在设置头文件和库以供使用。我使用的是 Visual C++ 2013,我添加了 ffmpeg 头文件和库的路径。我链接到 ffmpeg lib
文件夹中的每个 lib 文件,显然它们都不匹配 av_register_all
和 avformat_open_input
。
这是尝试构建的输出:
1>------ Build started: Project: ffmpeg_learning, Configuration: Debug Win32 ------
1> ffmpeg_learning.cpp
1>ffmpeg_learning.obj : error LNK2019: unresolved external symbol _av_register_all referenced in function _main
1>ffmpeg_learning.obj : error LNK2019: unresolved external symbol _avformat_open_input referenced in function _main
1>c:\users\edward severinsen\documents\visual studio 2013\Projects\ffmpeg_learning\Debug\ffmpeg_learning.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
这是我的代码:
#include "stdafx.h"
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
#pragma comment(lib, "avcodec.lib")
#pragma comment(lib, "avformat.lib")
#pragma comment(lib, "swscale.lib")
#pragma comment(lib, "avdevice.lib")
#pragma comment(lib, "avutil.lib")
#pragma comment(lib, "avfilter.lib")
#pragma comment(lib, "postproc.lib")
#pragma comment(lib, "swresample.lib")
int main(int argc, char* argv[])
{
av_register_all();
AVFormatContext* pFormatCtx = NULL;
//Open video file
if (avformat_open_input(&pFormatCtx, argv[1], NULL, 0))
{
//Couldn't open the file
return -1;
}
return 0;
}
我不知道我错过了什么。任何帮助将非常感激。谢谢。