QMediaPlayer undefined-reference linker errors

c++, qt

Solution

Add multimedia module to QT in .pro file, run qmake and then build your project:

QT += core gui multimedia

In Qt 5 that QMediaPlayer class is in multimedia module. And you might want the widgets module too (i see you have a mainwindow)

LE: Use the include without module folder:

#include <QMediaPlayer> 

Problem

I installed Qt5 and since Phonon is not supported in Qt5 I'm forced to use something else, so I decided to use QtMultimedia. .pro file: ``` QT += core gui CONFIG += mobility MOBILITY += multimedia ``` .cpp code: ``` #include "mainwindow.h" #include "ui_mainwindow.h" #include <QtGui> #include <QtCore> #include <QtMultimedia/QMediaPlayer> ... void MainWindow::on_pushButton_clicked() { QMediaPlayer *player = new QMediaPlayer(this); player->setVolume(50); player->setMedia(QUrl::fromLocalFile("some_path")); player->play(); } ``` But I'm getting following errors: How can I solve this. Thank you

Original source