Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Linker QT error
Forum Updated to NodeBB v4.3 + New Features

Linker QT error

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 3.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zola
    wrote on last edited by
    #1

    Even if I added [qt+=multimedia to my qt4.8.6 .pro file, I get these errors:

    mainwindow.o: In function MainWindow::MainWindow(QWidget*)': /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:20: undefined reference to QMediaServiceProvider::defaultServiceProvider()'
    /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:20: undefined reference to QMediaPlayer::QMediaPlayer(QObject*, QFlags<QMediaPlayer::Flag>, QMediaServiceProvider*)' /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:22: undefined reference to QMediaPlaylist::QMediaPlaylist(QObject*)'
    /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:23: undefined reference to QMediaContent::QMediaContent(QUrl const&)' /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:23: undefined reference to QMediaPlaylist::addMedia(QMediaContent const&)'
    /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:23: undefined reference to QMediaContent::~QMediaContent()' /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:24: undefined reference to QMediaContent::QMediaContent(QUrl const&)'
    /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:24: undefined reference to QMediaPlaylist::addMedia(QMediaContent const&)' /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:24: undefined reference to QMediaContent::~QMediaContent()'
    /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:26: undefined reference to QVideoWidget::QVideoWidget(QWidget*)' /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:27: undefined reference to QMediaPlayer::setVideoOutput(QVideoWidget*)'
    /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:30: undefined reference to QMediaPlaylist::setCurrentIndex(int)' /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:31: undefined reference to QMediaPlayer::play()'
    /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:23: undefined reference to QMediaContent::~QMediaContent()' /home/ubuntuccbbb/build-videoplayerbbb-Qt_for_BBB-Debug/../videoplayerbbb/mainwindow.cpp:24: undefined reference to QMediaContent::~QMediaContent()'

    What more to try?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      That because it's not directly part of Qt 4. You need the Qt Mobility module.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Z 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        That because it's not directly part of Qt 4. You need the Qt Mobility module.

        Z Offline
        Z Offline
        Zola
        wrote on last edited by
        #3

        @SGaist How to include qt mobility in my .pro file?

        QT += mobility doesn't work

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You need to build and install the module first. After that you can use QT += multimedia

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zola
            wrote on last edited by
            #5

            @SGaist I added it but it still doesn't work.

            jsulmJ 1 Reply Last reply
            0
            • Z Zola

              @SGaist I added it but it still doesn't work.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Zola Did you do this first "You need to build and install the module first" as suggested by SGaist??

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              Z 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Zola Did you do this first "You need to build and install the module first" as suggested by SGaist??

                Z Offline
                Z Offline
                Zola
                wrote on last edited by Zola
                #7

                @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.

                1. 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 = app

                INCLUDEPATH += /usr/include/QtMobility/
                INCLUDEPATH += /usr/include/QtMultimediaKit/

                SOURCES += main.cpp
                mainwindow.cpp

                HEADERS += mainwindow.h

                FORMS += mainwindow.ui

                and it gives me errors I wrote above.

                1 Reply Last reply
                0
                • jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Same compiler error messages?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  Z 1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Are you sure you built Qt Mobility with the right version of Qt ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      Same compiler error messages?

                      Z Offline
                      Z Offline
                      Zola
                      wrote on last edited by Zola
                      #10

                      @jsulm Look at post above :) I built it with 4.8.7.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        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.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1
                        • Z Offline
                          Z Offline
                          Zola
                          wrote on last edited by Zola
                          #12

                          @SGaist How I can install required Qt Mobility version when building my qt 4.8.7? ./configure -mobility? or?

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            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

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            1

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved