Qt Gui for multimedia with qt5 not recognizing the multimedia library

  • Hello,

    I am new in using qt for gui, I am trying to creat a project that shows a video in the main page, i followed the tutorial in http://qt-project.org/doc/qt-4.8/multimedia-videowidget.html

    I got the following error:

    DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I../VideoWidgetSurface -I/usr/include/qt5 -I/usr/include/qt5/QtMultimedia -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -I. -o main.o ../VideoWidgetSurface/main.cpp
    In file included from ../VideoWidgetSurface/main.cpp:2:0:
    ../VideoWidgetSurface/videoplayer.h:45:25: fatal error: QTGui/QWidget: No such file or directory
    #include <QTGui/QWidget>
    compilation terminated.
    make: *** [main.o] Error 1
    15:47:55: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project VideoWidgetSurface (kit: Desktop)
    When executing step 'Make'
    15:47:55: Elapsed time: 00:00.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You're following a Qt 4 tutorial using Qt 5. You should rather follow the latest documentation.

    QWidget and friends have moved to their own module name widgets and the include path would be QtWidgets/QWidget. Anyway better just use

    @#include <QWidget>@

    You should also add

    @QT += widgets@

    to your pro file

  • Actually it doesn't link the widgets library, not multimedia, QWidget is in widgets module in Qt5, so you'll need to add:
    @QT += widgets@
    in your .pro file, run qmake and then rebuild.

    LE: too late, there was a feature that warns you when you post and someone already posted on that topic, that doesn't work anymore or i don't remember correctly?

    Anyway, in Qt5 there is a "MultimediaWidgets":http://doc.qt.io/qt-5/qtmultimediawidgets-index.html module that already has a "video-widget":http://doc.qt.io/qt-5/qvideowidget.html.

  • @zlatomir and @SGaist Thank you both. I tryed but I got errors and as I mentioned am a biggener where I dont really understand the errors. Therefore, I created new project with the latest documentation for qt5 from the following link: http://doc.qt.io/qt-5/qtmultimediawidgets-videowidget-example.html

    and I got the following error:

    16:45:03: Running steps for project videowidget...
    16:45:03: Starting: "/usr/lib/x86_64-linux-gnu/qt5/bin/qmake" /home/reem/videowidget/videowidget.pro -r -spec linux-g++-64 CONFIG+=debug
    Project ERROR: Unknown module(s) in QT: multimediawidgets multimedia
    16:45:03: The process "/usr/lib/x86_64-linux-gnu/qt5/bin/qmake" exited with code 3.
    Error while building/deploying project videowidget (kit: Desktop)
    When executing step 'qmake'
    16:45:03: Elapsed time: 00:00.

  • Lifetime Qt Champion

    Since it looks like you are using your distribution's Qt, did you check that you have all Qt 5 dev packages installed ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.