Qt on Linux with X11 Link Errors
-
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 += x11extrasCompile 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. -
I added this to project, but it still does not work:
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. -
Hi,
It's "-lX11"
-
LIBS += -lX11
-
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 :-)