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. error: undefined reference to `snd_device_name_hint'

error: undefined reference to `snd_device_name_hint'

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.8k 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.
  • I Offline
    I Offline
    In Fo
    wrote on last edited by
    #1

    In my project I added a class. In its .h file I started typing:

    #include <alsa/asoundlib.h>
    

    When I typed al, QtCreator allowed me to pick alsa/
    When I typed asou, it allowed me to pick asoundlib.h.
    This leads me to believe that alsa development library is installed and visible to QtCreator.
    Next, I start typing code in the body of the class.

        name = snd_device_name_get_hint(*n, "NAME");
    

    When I type snd_device, it allows me to pick the function above from the list of three similar functions. This leads me to believe that the included ALSA API is visible to QtCreator.

    When I Ctrl-click on the function name, QtCreator opens ALSA's control.h where it is declared.
    So far it is all nice and dandy.

    But when I build the project, after running qmake, of course, it throws the error in the subject.
    So which tool still does not know that the proper .h files are included?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You also need to link against the alsa libs I would guess.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • I Offline
        I Offline
        In Fo
        wrote on last edited by
        #3

        Thank you!

        For posterity, this means opening .pro file in editor, right-clicking empty space, and selecting "Add library", then browsing to /lib64 and selecting libasound.so, which after un-checking Windows and Mac platforms then adds the following line to the .pro file:

        unix:!macx: LIBS += -lasound
        

        Then run qmake and build.

        Christian EhrlicherC 1 Reply Last reply
        3
        • I In Fo

          Thank you!

          For posterity, this means opening .pro file in editor, right-clicking empty space, and selecting "Add library", then browsing to /lib64 and selecting libasound.so, which after un-checking Windows and Mac platforms then adds the following line to the .pro file:

          unix:!macx: LIBS += -lasound
          

          Then run qmake and build.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @In-Fo Please mark this topic as solved then, thx.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1

          • Login

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