Problem with QMediaPlayer
-
Hello
I'm doing a project on QT Creator, with C++,
and I try to put sound on my window, but impossible to include QMediaPlayer, I understood that it was necessary to modify the CMake for that, but all the tutorials that I found are for QT5, but I have QT 6.4.2.Here is my CMake
tried to do:
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Qt6 Widgets::Multimedia)or :
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia)but :
erreur : Target "NewProj" links to: Qt6::Multimedia but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.Thank you for your answers
-
Hello
I'm doing a project on QT Creator, with C++,
and I try to put sound on my window, but impossible to include QMediaPlayer, I understood that it was necessary to modify the CMake for that, but all the tutorials that I found are for QT5, but I have QT 6.4.2.Here is my CMake
tried to do:
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Qt6 Widgets::Multimedia)or :
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia)but :
erreur : Target "NewProj" links to: Qt6::Multimedia but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.Thank you for your answers
@Youenn Do you have Qt Multimedia installed?
You can check by running your maintenance tool in Qt Creator:
Menu Bar->Tools->Qt Maintenance Tool->Start Maintenance Tool->...->Add or Remove Components->Qt->Qt 6.4.2->Additional Libraries->Qt Multimidia.
See if it's checked or not.
-
@Youenn Do you have Qt Multimedia installed?
You can check by running your maintenance tool in Qt Creator:
Menu Bar->Tools->Qt Maintenance Tool->Start Maintenance Tool->...->Add or Remove Components->Qt->Qt 6.4.2->Additional Libraries->Qt Multimidia.
See if it's checked or not.
-
Hello
I'm doing a project on QT Creator, with C++,
and I try to put sound on my window, but impossible to include QMediaPlayer, I understood that it was necessary to modify the CMake for that, but all the tutorials that I found are for QT5, but I have QT 6.4.2.Here is my CMake
tried to do:
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Qt6 Widgets::Multimedia)or :
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia)but :
erreur : Target "NewProj" links to: Qt6::Multimedia but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.Thank you for your answers
@Youenn said in Problem with QMediaPlayer:
target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Qt6 Widgets::Multimedia)
Just a small observation: I'm not sure, but I think this is wrong, I would appreciate if someone can confirm this.
Edit:
Yes, it is wrong. Thanks for confirming! -
it's work, with :
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets multimedia)target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia)
-
it's work, with :
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Multimedia)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets multimedia)target_link_libraries(NewProj PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia)
-
-
-
-
-
-
-