Unsolved Linker QT error
-
Hi,
That because it's not directly part of Qt 4. You need the Qt Mobility module.
-
@SGaist How to include qt mobility in my .pro file?
QT += mobility doesn't work
-
You need to build and install the module first. After that you can use
QT += multimedia
-
@SGaist I added it but it still doesn't work.
-
@Zola Did you do this first "You need to build and install the module first" as suggested by SGaist??
-
@jsulm Yes module is installed, and it doesn't work.
Here are the steps I gone through to make project:
1)Created new project in Qt Creator.
- in my main.cpp file I insterted this code
#include "mainwindow.h"
#include <QApplication>
#include <QMediaPlaylist>
#include <qmobilityglobal.h>
#include <QVideoWidget>
#include <QMediaPlayer>int main(int argc, char *argv[])
{
QApplication a(argc, argv);QMediaPlayer *player = new QMediaPlayer; QMediaPlaylist *playlist = new QMediaPlaylist(player); playlist->addMedia(QUrl("http://example.com/myclip1.mp4")); playlist->addMedia(QUrl("http://example.com/myclip2.mp4")); QVideoWidget *videoWidget = new QVideoWidget; player->setVideoOutput(videoWidget); videoWidget->show(); playlist->setCurrentIndex(1); player->play(); return a.exec();
}
and changed my pro file to this:
#-------------------------------------------------
Project created by QtCreator 2015-11-26T03:58:31
#-------------------------------------------------
QT += core gui multimedia multimediawidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = videoplater
TEMPLATE = appINCLUDEPATH += /usr/include/QtMobility/
INCLUDEPATH += /usr/include/QtMultimediaKit/SOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
and it gives me errors I wrote above.
-
Same compiler error messages?
-
Are you sure you built Qt Mobility with the right version of Qt ?
-
@jsulm Look at post above :) I built it with 4.8.7.
-
One thing that looks suspicious is that you added the include path to QtMobility. If you needed to do that, you would also have to add the link part i.e.
LIBS += -lQtMultiMedia -lQtMultiMediaWidgets
.But it looks like either Qt Mobility is not correctly installed or not built with the same version of Qt you are currently using.
-
@SGaist How I can install required Qt Mobility version when building my qt 4.8.7? ./configure -mobility? or?
-
First clone the qt-mobility sources:
git clone git://code.qt.io/qt-mobility/qt-mobility.git
Do an out of source build:
mkdir qt-mobility-build
cd qt-mobility-build
/path/to/qt-mobility/configure -qmake-exec /path/to/your/qmake
make && make install