Quantcast
Channel: Qt DevNet forums: Installation and Deployment
Viewing all articles
Browse latest Browse all 2113

Build error using Qt5.2.1 and libvlc-qt

$
0
0
I am a total newbie and just learning Qt. I am trying the DemoPlayer example here [github.com] that shows how to link Qt to libVLC. I installed Qt5.2.1 on a Windows XP machine, vlc-qt-0.8.1 and installed libVLC . I think I have setup the project correctly with the libraries and the include paths but when I build I got errors shown below: C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN8VlcMediaC1ERK7QStringbP11VlcInstance’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN14VlcMediaPlayer4openEP8VlcMedia’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN8VlcMediaC1ERK7QStringP11VlcInstance’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN14VlcMediaPlayer4openEP8VlcMedia’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN9VlcCommon4argsEv’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN11VlcInstanceC1ERK11QStringListP7QObject’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN14VlcMediaPlayerC1EP11VlcInstance’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN14VlcMediaPlayer14setVideoWidgetEP16VlcVideoDelegate’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN14VlcWidgetVideo14setMediaPlayerEP14VlcMediaPlayer’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN21VlcWidgetVolumeSlider14setMediaPlayerEP14VlcMediaPlayer’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN21VlcWidgetVolumeSlider9setVolumeEi’ C:\Qt\vlc-qt-0.8.1\examples\demo-player\src\DemoPlayer.cpp:-1: error: undefined reference to `_imp___ZN13VlcWidgetSeek14setMediaPlayerEP14VlcMediaPlayer’ :-1: error: release/DemoPlayer.o: bad reloc address 0×20 in section `.text$_ZN7QStringD1Ev[__ZN7QStringD1Ev]’ collect2.exe:-1: error: error: ld returned 1 exit status Here are my files: demo-player.pro TEMPLATE = subdirs   SUBDIRS += \     src src.pro TARGET      = demo-player TEMPLATE    = app   QT          += core gui widgets   SOURCES     += main.cpp\                DemoPlayer.cpp   HEADERS     += DemoPlayer.h   FORMS       += DemoPlayer.ui     # Edit below for custom library location LIBS     += -LC:\Qt\libvlc-qt\lib -lvlc-qt -lvlc-qt-widgets INCLUDEPATH += C:\Qt\libvlc-qt\include DemoPlayer.h TARGET      = demo-player TEMPLATE    = app   QT          += core gui widgets   SOURCES     += main.cpp\                DemoPlayer.cpp   HEADERS     += DemoPlayer.h   FORMS       += DemoPlayer.ui     # Edit below for custom library location LIBS     += -LC:\Qt\libvlc-qt\lib -lvlc-qt -lvlc-qt-widgets INCLUDEPATH += C:\Qt\libvlc-qt\include DemoPlayer.cpp #include <QFileDialog> #include <QInputDialog>   #include <vlc-qt/Common.h> #include <vlc-qt/Instance.h> #include <vlc-qt/Media.h> #include <vlc-qt/MediaPlayer.h>   #include "DemoPlayer.h" #include "ui_DemoPlayer.h"   DemoPlayer::DemoPlayer(QWidget *parent)     : QMainWindow(parent),       ui(new Ui::DemoPlayer),       _media(0) {     ui->setupUi(this);       _instance = new VlcInstance(VlcCommon::args(), this);     _player = new VlcMediaPlayer(_instance);     _player->setVideoWidget(ui->video);       ui->video->setMediaPlayer(_player);     ui->volume->setMediaPlayer(_player);     ui->volume->setVolume(50);     ui->seek->setMediaPlayer(_player);       connect(ui->actionOpenLocal, SIGNAL(triggered()), this, SLOT(openLocal()));     connect(ui->actionOpenUrl, SIGNAL(triggered()), this, SLOT(openUrl()));     connect(ui->actionPause, SIGNAL(triggered()), _player, SLOT(pause()));     connect(ui->actionStop, SIGNAL(triggered()), _player, SLOT(stop()));     connect(ui->openLocal, SIGNAL(clicked()), this, SLOT(openLocal()));     connect(ui->openUrl, SIGNAL(clicked()), this, SLOT(openUrl()));     connect(ui->pause, SIGNAL(clicked()), _player, SLOT(pause()));     connect(ui->stop, SIGNAL(clicked()), _player, SLOT(stop())); }   DemoPlayer::~DemoPlayer() {     delete _player;     delete _media;     delete _instance;     delete ui; }   void DemoPlayer::openLocal() {     QString file =             QFileDialog::getOpenFileName(this, tr("Open file"),                                          QDir::homePath(),                                          tr("Multimedia files(*)"));       if (file.isEmpty())         return;       _media = new VlcMedia(file, true, _instance);       _player->open(_media); }   void DemoPlayer::openUrl() {     QString url =             QInputDialog::getText(this, tr("Open Url"), tr("Enter the URL you want to play"));       if (url.isEmpty())         return;       _media = new VlcMedia(url, _instance);       _player->open(_media); } main.cpp #include <QCoreApplication> #include <QTextCodec> #include <QApplication>   #include "DemoPlayer.h"   int main(int argc, char *argv[]) {     QCoreApplication::setApplicationName("VLC-Qt Demo Player");     QCoreApplication::setAttribute(Qt::AA_X11InitThreads);       //QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));       QApplication app(argc, argv);     DemoPlayer mainWindow;     mainWindow.show();       return app.exec(); } I am not sure if this has something to do with the version of Qt that I used? According to this [projects.tano.si] I should be installing Qt 5.1.1 and VLC 2.0.8. I tried installing Qt5.1.1 but did not find the binaries and by the look of it , it seems complicated to rebuild from source. Anybody please tell me what I am doing wrong? Any suggestions would be greatly appreciated.

Viewing all articles
Browse latest Browse all 2113

Trending Articles