libvlc_new (0, NULL);分段故障 [英] libvlc_new (0, NULL); segmentation fault
本文介绍了libvlc_new (0, NULL);分段故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用此行时遇到问题:
I have a problem when I use this line :
vlcInstance = libvlc_new(0, NULL);
vlcInstance 在我的标题中声明:
libvlc_media_player_t *vlcPlayer;
我正在使用 Qt 5.0.1,但出现此错误:
I am using Qt 5.0.1 and I have this error:
The inferior stopped because it received a signal from the Operating System.
Signal name : SIGSEGV Signal meaning : Segmentation fault
有人可以帮我吗?
推荐答案
我在 64 位 Kubuntu 13.04 上使用 Qt Creator 2.7.2 和 QT 5.1.0.我也在使用 vlc-2.2.0-git.
I am using Qt Creator 2.7.2 with QT 5.1.0 on 64-bit Kubuntu 13.04. I'm also using vlc-2.2.0-git.
我创建了一个新的 QT 项目.
I created a new QT project.
我将此添加到新项目文件中(根据需要更改您的 vlc 路径):
I added this to the new project file (change your vlc paths as needed):
INCLUDEPATH += /home/linux/vlc/install/include
LIBS += -L"/home/linux/vlc/install/lib" -lvlc
简单的 main.cpp(包括明显有段错误的代码):
bare-bones main.cpp (including your code that apparently segfaults):
#include <QtDebug>
#include "vlc/libvlc.h"
#include "vlc/libvlc_media.h"
#include "vlc/libvlc_media_player.h"
int main(int argc, char *argv[]) {
qDebug() << "Starting...";
libvlc_instance_t* p_instance = libvlc_new(0, NULL);
qDebug() << "p_instance" << p_instance;
if (p_instance) {
libvlc_media_player_t *p_media_player = libvlc_media_player_new(p_instance);
qDebug() << "p_media_player" << p_media_player;
if (p_media_player) {
libvlc_media_player_release(p_media_player);
}
libvlc_free(p_instance);
}
qDebug() << "Exit normally";
}
这对我来说运行得很好,没有段错误:
This runs just fine for me, no segfault:
Starting...
p_instance 0x19140f0
p_media_player 0x19da6d8
Exit normally
这篇关于libvlc_new (0, NULL);分段故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文