Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use QSound on Visual Studio?
Qt 6.12 LTS is out! See what's new in the release blog

How to use QSound on Visual Studio?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.0k Views
  • 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.
  • CesarC Offline
    CesarC Offline
    Cesar
    wrote on last edited by Cesar
    #1

    I'm trying to use QSound lib in my project, but it didn't find the include cannot open source file "QMediaPlayer"
    I tried:

    #include <QSound>
    #include <QtMultimedia/QSound>
    

    It also prompts that it can be installed using vcpkg command: vcpkg install qt5-multimedia:x64-windows
    i tried it, but it fails to compile:

    CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:175 (message):
    
    Failed to download file.
          If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY environment
          variables to "https://user:password@your-proxy-ip-address:port/".
          Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues
    
    Call Stack (most recent call first):
      scripts/cmake/vcpkg_acquire_msys.cmake:78 (vcpkg_download_distfile)
      ports/icu/portfile.cmake:77 (vcpkg_acquire_msys)
      scripts/ports.cmake:90 (include)
    

    I have the folder QtMultimedia under the include folder.
    I also tried manually adding the paths to the project as seen in this answer: Stack

    e3c7f18b-6dc9-41e0-872f-4cc2ade17af9-image.png

    VS 2022, Qt 6.3.1

    In docs it says I need to add qmake: QT += multimedia but i have no .pro file, where should i add it on Visual Studio?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      In the Qt project setting tab, there should be something like "Qt Modules", add "multimedia" in it.
      Or is there any menu named "Qt Modules"? I remember there was one when I used vs with qt a long time ago. That should also work.

      1 Reply Last reply
      1
      • CesarC Offline
        CesarC Offline
        Cesar
        wrote on last edited by
        #3

        Thank you, this did work, also the include need is #include <QtMultimedia/qsoundeffect.h>

        1 Reply Last reply
        0

        • Login

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