Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with QMediaPlayer
Forum Updated to NodeBB v4.3 + New Features

Problem with QMediaPlayer

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 952 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Youenn
    wrote on last edited by
    #1

    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

    Capture.PNG

    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

    C 2 Replies Last reply
    0
    • Y Youenn

      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

      Capture.PNG

      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

      C Offline
      C Offline
      CPPUIX
      wrote on last edited by
      #2

      @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.

      Y 1 Reply Last reply
      2
      • C CPPUIX

        @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.

        Y Offline
        Y Offline
        Youenn
        wrote on last edited by
        #3

        @Abderrahmene_Rayene

        Thank you so much
        indeed it was not installed,
        I'll try this and mark it as solved if it works.

        and the code below for those who might be interested.

        1 Reply Last reply
        0
        • Y Youenn

          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

          Capture.PNG

          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

          C Offline
          C Offline
          CPPUIX
          wrote on last edited by CPPUIX
          #4

          @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!

          1 Reply Last reply
          1
          • Y Offline
            Y Offline
            Youenn
            wrote on last edited by
            #5

            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)

            C 1 Reply Last reply
            0
            • Y Youenn

              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)

              C Offline
              C Offline
              CPPUIX
              wrote on last edited by
              #6

              @Youenn Great! Don't forget to mark this topic as solved.

              1 Reply Last reply
              0
              • Y Youenn marked this topic as a regular topic on
              • Y Youenn marked this topic as a question on
              • Y Youenn marked this topic as a regular topic on
              • Y Youenn marked this topic as a question on
              • Y Youenn marked this topic as a regular topic on
              • Y Youenn marked this topic as a question on
              • Y Youenn marked this topic as a regular topic on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved