Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved Qt on Linux with X11 Link Errors

    General and Desktop
    2
    8
    615
    Loading More Posts
    • 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
      Windy last edited by Windy

      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 Reply Quote 0
      • W
        Windy last edited by

        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 Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          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 Reply Quote 0
          • W
            Windy @SGaist last edited by

            @SGaist Super. And where does that go exactly?

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              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 Reply Quote 0
              • W
                Windy @SGaist last edited by

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

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  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 Reply Quote 0
                  • W
                    Windy @SGaist last edited by

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

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post