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. Qt on Linux with X11 Link Errors
Forum Update on Monday, May 27th 2025

Qt on Linux with X11 Link Errors

Scheduled Pinned Locked Moved Solved General and Desktop
8 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.
  • W Offline
    W Offline
    Windy
    wrote on 9 Apr 2020, 16:18 last edited by Windy 4 Sept 2020, 17:44
    #1

    I'm trying to send Global [Root Window?] X11 Mouse events from Qt Widget application.
    Found some example code and moved it into my project.

    Headers look like this:

    #include <QMainWindow>
    #include <QDebug>
    #include <QString>
    #include <mouseclick.h>
    //#include <stdio.h>
    //#include <stdlib.h>
    //#include <string.h>
    #include <unistd.h>
    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    

    My Functions call XOpenDisplay, XQueryPointer, XSendEvent, XFlush.

    I've added this to Project file.
    QT += x11extras

    Compile works, but these link errors:

    /usr/bin/ld: mouseclick.o: undefined reference to symbol 'XFlush'
    //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
    Makefile:298: recipe for target 'QtShowRunner' failed
    collect2: error: ld returned 1 exit status
    make: *** [QtShowRunner] Error 1
    09:11:49: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project QtShowRunner (kit: Desktop Qt 5.14.2 GCC 64bit)
    When executing step "Make"
    

    Commenting out XFlush just causes another XCall to show up this way, so apparently the XLibrary is not being included in link. Can't find an example page that shows how to fix the Project file.

    Is this the problem? and How do I fix it? Or is there another better way to send global Mouse Click events?
    Thanks.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      Windy
      wrote on 9 Apr 2020, 17:28 last edited by
      #2

      I added this to project, but it still does not work:
      alt text

      alt text

      Confirmed that libX11.so is present at the specified path.

      Details here:
      https://windyweather.net/2019/04/09/qt-linking-with-x11/

      How do I tell Qt where to find this library so the link will work?
      Thanks.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 9 Apr 2020, 17:53 last edited by
        #3

        Hi,

        It's "-lX11"

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        W 1 Reply Last reply 9 Apr 2020, 18:26
        0
        • S SGaist
          9 Apr 2020, 17:53

          Hi,

          It's "-lX11"

          W Offline
          W Offline
          Windy
          wrote on 9 Apr 2020, 18:26 last edited by
          #4

          @SGaist Super. And where does that go exactly?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 9 Apr 2020, 18:27 last edited by
            #5
            LIBS += -lX11
            

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            W 1 Reply Last reply 9 Apr 2020, 18:43
            0
            • S SGaist
              9 Apr 2020, 18:27
              LIBS += -lX11
              
              W Offline
              W Offline
              Windy
              wrote on 9 Apr 2020, 18:43 last edited by
              #6

              @SGaist Allllll rightyyyyyy thennnnnnnn
              Thanks very much.
              Just got a successful build. Now to see if it works.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 9 Apr 2020, 19:08 last edited by
                #7

                Good !

                Then please mark the thread as solved using the "Topic Tools" buttons si that other forum users may know a solution has been found :-)

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                W 1 Reply Last reply 9 Apr 2020, 20:45
                0
                • S SGaist
                  9 Apr 2020, 19:08

                  Good !

                  Then please mark the thread as solved using the "Topic Tools" buttons si that other forum users may know a solution has been found :-)

                  W Offline
                  W Offline
                  Windy
                  wrote on 9 Apr 2020, 20:45 last edited by
                  #8

                  @SGaist Thanks again. The code does not do the right thing yet. but it does compile and run.

                  1 Reply Last reply
                  0

                  1/8

                  9 Apr 2020, 16:18

                  • Login

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