Results 1 to 2 of 2

Thread: Undefined reference

  1. #1
    Join Date
    Jan 2020
    Qt products

    Default Undefined reference

    I am trying to connect to Jack (Kubuntu 18.04, so it is Jack2) from a Qt app:
    Qt Code:
    1. void JackPortInfo::signal_handler ( int sig )
    2. {
    3. jack_client_close ( client );
    4. qDebug() << "JackPortInfo: signal received, exiting ...";
    5. exit ( 0 );
    6. }
    To copy to clipboard, switch view to plain text mode 
    But I ran into a problem:
    CMakeFiles/TestApp.dir/src/jackportinfo.cpp.o: In function `JackPortInfo::signal_handler(int)':
    /home/me/projects/TestApp/src/jackportinfo.cpp:32: undefined reference to `jack_client_close'
    collect2: error: ld returned 1 exit status

    I thought
    #include <jack/jack.h>
    should resolve this, but it doesn't.

    There is a bunch of jack related .h files in
    so it seems that what should be there is present.
    Maybe I ought to post this question in a different forum?

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 728 Times in 718 Posts
    Qt products
    Windows Android

    Default Re: Undefined reference

    An "undefined reference" means that you have not linked to whatever library it is that contains the function. Including the header file only fixes compile-time errors, not link errors.

    I have no idea what name your missing library has. Look in your Jack2 documentation or distribution. You will need to modify your CMakeLists.txt file to add the library reference to the target_link_libraries() directive..
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. undefined reference
    By deepakswaroop in forum Newbie
    Replies: 1
    Last Post: 2nd March 2011, 06:46
  2. Undefined reference
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2011, 15:45
  3. undefined reference
    By digidas in forum Newbie
    Replies: 9
    Last Post: 19th May 2010, 13:04
  4. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 13:45
  5. Undefined reference to crt
    By derektaprell in forum Installation and Deployment
    Replies: 0
    Last Post: 20th October 2009, 08:34


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.