在qt创建者中链接ffmpeg库时的运行时错误 [英] runtime error when linking ffmpeg libraries in qt creator

查看:200
本文介绍了在qt创建者中链接ffmpeg库时的运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里很新,但我听说如果你想要一个问题回答,stackoverflow是要问的地方。所以我希望我的问题不是微不足道的,每个人都会因为缺乏研究而感到烦恼(我已经尝试过谷歌已经两天了D =没有进展!)
我也在这个问题Qt论坛,但我想我也会在这里问。

I'm quite new around here but i hear that if you want a question answered, stackoverflow is the place to ask it >.<. So i hope that my question isn't too trivial that everyone will get annoyed at my lack of research (I've tried googling for two days already D= no progress!) I've also asked this question in the Qt forums, but i figured i'd ask here too.

so ...

几天我一直在玩opengl等,试图写一个视频播放器。

For the last few days I’ve been fiddling around with opengl and the like, trying to write a video player.

但是,当我尝试导入ffmpeg库(avcodec,avformat ,avutils等),运行时发生错误(程序编译正常)。当编译并运行在调试模式时,错误消息给我一个内存地址和错误代码135(找不到DLL)。

However, when i try to import the ffmpeg libraries (avcodec, avformat, avutils etc), an error occurs on runtime (the program compiles fine). When compiled and run in debug mode, the error message gives me only a memory address and error code 135 (DLL not found).

当我包含一个函数从我的代码中的这些库(例如av_register_all()),它发生,无论函数是否实际调用。

This error occurs when i include a function from those libraries in my code (e.g. av_register_all()) and it occurs regardless of whether the function is actually called.

所以我在想我在做某事链接这些库时出错。
我目前正在使用:
Windows vista(32位),
Qt创建者2.4.1基于Qt 4.7.4(32位),
Zeranoe的FFmpeg构建git-3233ad4( 2012-06-30)

So i’m thinking that I’m doing something wrong when linking these libraries. I’m currently using: Windows vista (32bit), Qt creator 2.4.1 based on Qt 4.7.4 (32bit), Zeranoe’s FFmpeg build git-3233ad4 (2012-06-30)

我的.pro文件包含:

My .pro file consists of:

QT       += core gui opengl

TARGET = test
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp \
    glwidget.cpp

HEADERS += mainwindow.h \
    glwidget.h \

FORMS    += mainwindow.ui


LIBS += -L"$$_PRO_FILE_PWD_/libraries/ffmpeg/libs/" -lavcodec -lavformat -lavutil
INCLUDEPATH += libraries/ffmpeg/includes

我尝试过许多变体LIBS + =行,并检查我的文件路径多次。但是,在所有这些变体中,DLL未找到错误发生=(。

I’ve tried many variations to the LIBS += line and checked my filepath many times. However, the DLL not found error occurs in all of these variations =(.

这些包含的东西有什么我忘记吗?

Is there something I’m forgetting when doing these includes?

提前感谢

推荐答案

p>由于错误表示没有找到DLL,并且当您包含ffmpeg函数时会发生这种情况,这意味着ffmpeg库是动态链接的(即它们是DLL),这意味着对于您的exe来说,它需要加载ffmpeg DLL,您需要将这些DLL放在与exe文件相同的目录中,将它们复制到那里。使用依赖关系walker 查看您需要复制的DLL,但它们应该看起来像 avcodec-52.dll,avdevice-52.dll,avformat-52.dll,avutil-49.dll ,还有几个,取决于你的ffmpeg的构建。

Since the error says that a DLL is not found and it happens when you include ffmpeg functions, it means that the ffmpeg libraries are dynamically linked (i.e. they're DLLs). That means that for your exe to work, it needs to load the ffmpeg DLLs. You need to have those DLLs in the same directory as your exe file. Copy them there. Use dependency walker to see which DLLs you need to copy, but they should look something like avcodec-52.dll, avdevice-52.dll, avformat-52.dll, avutil-49.dll, and maybe a few more, depending on your build of ffmpeg.

这篇关于在qt创建者中链接ffmpeg库时的运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆