[英]Qt C++ ffmpeg cannot find library
I use Qt 5.0.2 with Mingw 4.7 on windows. 我在Windows上将Qt 5.0.2与Mingw 4.7一起使用。
I'm working on a c++ program and i'm trying to get the duration of video files. 我正在使用C ++程序,正在尝试获取视频文件的持续时间。 I found ffmpeg .
我找到了ffmpeg 。 Now i tried to compile a simple program but I think it fails with the libraries.
现在,我尝试编译一个简单的程序,但是我认为该库无法运行。 I've tried to include both the shared and dev but they both will fail.
我试图包括共享和开发,但它们都会失败。 ( Zeranoe FFmpeg builds )
( Zeranoe FFmpeg构建 )
This is my pro file: 这是我的专业文件:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-shared\bin
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-shared\bin -lavcodec-55.dll - lavformat-55.dll -lavutil-52.dll
i get errors like: 我收到如下错误:
":-1: error: cannot find -lavcodec-55.dll" “:-1:错误:找不到-lavcodec-55.dll”
":-1: error: cannot find -lavformat-55.dll" “:-1:错误:找不到-lavformat-55.dll”
I've also tried: 我也尝试过:
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\include
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\lib
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib -lavcodec -lavformat -lavutil
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib -llibavcodec.dll.a -llibavformat.dll.a -llibavutil.dll.a
Here it gives a error "During startup program exited with code 0x0000135' 在这里它给出了一个错误“在启动程序退出时,代码为0x0000135”
I even tried to include each library individually. 我什至试图单独包括每个库。 But no results..
但是没有结果。
This is my main file: 这是我的主文件:
#include <iostream>
using namespace std;
extern "C" {
#include <libavcodec/avcodec.h> // required headers
#include <libavformat/avformat.h>
}
int main(int argc, char**argv) {
av_register_all(); // offending library call
return 0;
}
A program simple as this will have 2 outcomes: 一个简单的程序将产生两个结果:
Can someone tell me what it is i'm doing wrong? 有人可以告诉我我在做什么错吗? Or even give me a hint?
甚至给我一个提示? I can't really find a lot of good documentation on this one.
我真的找不到关于这个的很多好的文档。
Thanks in advance! 提前致谢!
Configure PRO-file as shown below: 配置PRO文件,如下所示:
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\include
LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib
LIBS += -lavcodec -lavformat -lavutil
Then, build the project, copy the all dll libraries from C:\\programming\\ffmpeg-20130606-git--win32-shared\\bin
to exe output path and run application. 然后,构建项目,将所有dll库从
C:\\programming\\ffmpeg-20130606-git--win32-shared\\bin
复制到exe输出路径并运行应用程序。
UPD UPD
Maybe you need to copy some of the following libraries from Qt\\5.0.2\\mingw47_32\\bin\\
: 也许您需要从
Qt\\5.0.2\\mingw47_32\\bin\\
复制以下某些库:
libgcc_s_sjlj-1.dll
libstdc++-6.dll
libwinpthread-1.dll
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.