我试图建立一个非常简单的Qt程序使用FFMpeg库。链接器错误与ffmpeg
目前我只想打开和关闭视频文件。
这里是我的项目文件:
QT += core gui
TARGET = avtest01
TEMPLATE = app
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib -lavformat
SOURCES += main.cpp
而且我的代码:
#include <QDebug>
extern "C" {
#include <libavformat/avformat.h>
}
int main(int argc, char *argv[])
{
if(argc > 1)
{
AVFormatContext *format_context;
qDebug() << argv[1];
if(avformat_open_input(&format_context, argv[1], NULL, NULL) == 0)
{
qDebug() << "open";
avformat_close_input(&format_context);
}
else
qDebug() << "error opening " << argv[1];
}
return 0;
}
不幸的是,连接失败:
Undefined symbols for architecture x86_64:
"avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)", referenced from:
_main in main.o
"avformat_close_input(AVFormatContext**)", referenced from:
_main in main.o
我使用Qt 5.1.0上苹果系统。
不合理不加评论? –
我在调用'avformat_open_input'时遇到同样的问题。你做了什么来解决这个问题?您为MacOS创建* FFmpeg *的方式有多不同? –