Nominate our 2022 Qt Champions!

Сan't use QtMultimedia in the project

  • Hello all!
    I need to add the ability to work with mp3-files. To do this I specify #include <QMediaPlayer> in the project. But the project does not compile and displays the following error

    error: QMediaPlayer: No such file or directory
            #include <QMediaPlayer>

    If I create a new clean project and specify "multimedia" in the .pro file, i.e. it turns out this line

    QT + = core gui multimedia

    then if you build the project, then pop up this errors

    error: cannot find -lQtMultimedia
    error: collect2: error: ld returned 1 exit status

    All the solutions that I saw with QMediaPlayer did not help me. I can’t determine where the problem, so I need someone's help.

  • Lifetime Qt Champion

    @Samovolk How did you install Qt and which version?
    On which OS?

  • Oh, I definitely forgot it. OS - debian 9.
    Installation was done through Synaptic. Installed: qt-sdk and qtcreator. Everything else was installed automatically. Qt version is 4.8.7.

  • Lifetime Qt Champion


    AFAIR, QtMultimedia is a Qt 5 module.

    In any case, unless you have strict constraints, you should pass to Qt 5.

  • @SGaist
    I knew it. Google confused me and I thought that the problem is not in the version. Updated to version 5 and it worked.
    Thanks for help.

Log in to reply