Play a video on qt 5.12 c++
-
Hello everybody :)
I'm trying to play a video in my c++ GUI, i found that i need to include in my scripts QMediaplayer and QVideoWidgets, but I got the error 'no such file or directory' .I'm using Qt creator 4.9.2 Based on Qt 5.12.4, running on ubuntu 18.04.
How can i install them?thanks
good day everyone -
@AliM93 Did you add
QT += multimedia
to your pro file (see https://doc.qt.io/qt-5/qmediaplayer.html)?
-
@jsulm i'm using a cmake file,, not qmake, so i don't have the .pro file. I've tried to add in my cmake script these lines:
find_package(Qt5 COMPONENTS Core Gui Widgets PrintSupport Sql Multimedia)
target_link_libraries(agree_gui ${QT_LIBRARIES} ${catkin_LIBRARIES}
(
Qt5::Multimedia
)but i got this error:
:-1: error: cannot find -lQt5::Multimedia -
@AliM93 said in Play a video on qt 5.12 c++:
from the terminal
This doesn't tell much.
Did you use apt to install Qt packages from Ubuntu? If so, did you install libqt5multimedia package? -
in the qt lib i have these libraries : the path is : QtCreator/latest/lib/Qt
- libQt5Multimedia.so.5
- libQt5Multimedia.so.5.12
- libQt5Multimedia.so.5.12.4
- libQt5MultimediaGstTools.so.5 (.12 .12.4)
- libQt5MultimediaQuick.so.5 (.12 .12.4)
- libQt5MultimediaWidgets.so.5 (.12 .12.4)
-
Hi,
You did not answer @jsulm's question: how exactly did you install Qt ? Using the Qt Online Installer ? Using your distribution package manager ?
Also how did you install Qt Creator ?
If you installed Qt using the package manager, you have to install the corresponding development packages.
-
@AliM93 said in Play a video on qt 5.12 c++:
QtCreator/latest/lib/Qt
This looks like the installation directory of QtCreator which doesn't matter.
Again: how exactly did you install Qt? Did you install Qt packages provided by your distribution (via apt)?
Please answer the questions else nobody will be able to help you. -
@AliM93 said in Play a video on qt 5.12 c++:
:-1: error: cannot find -lQt5::Multimedia
I guess you may need to try a different name for the library...
target_link_libraries(agree_gui ${QT_LIBRARIES} ${catkin_LIBRARIES} ( Qt5Multimedia )
-
@Pablo-J-Rogina i've tried but same error.
-
Then it's not a maybe, you just have installed Qt Creator.
In any case, are you trying to build a Qt application for ROS or just a Qt application ?
-
Then install Qt.
Where did you get Qt Creator from ?
-
@SGaist I got it from the link that i posted. I follow that link and then i installed qt creator with the ROS plugin.
How can i install qt?I noticed that in my Qt creator folder i have also this path:
QtCreator -> latest -> lib -> Qt --> (...)
may this mean i have also installed Qt? The code i wrote since now works well. is it possible that i installed only Qt Creator without Qt?Sorry for my bad installation skills.
thank you all. -
@AliM93 said in Play a video on qt 5.12 c++:
QtCreator -> latest -> lib -> Qt --> (...)
may this mean i have also installed Qt?No, these are Qt libraries used by QtCreator (QtCreator is a Qt application).
"is it possible that i installed only Qt Creator without Qt?" - I think so, as the link you posted only talks about QtCreator installation."How can i install qt?" - you can use Qt Online Installer (from official Qt web site). On Linux you can install Qt packages provided by the Linux distribution.