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. [SOLVED]Where to add the lX11 reference to Qt project on linux
QtWS25 Last Chance

[SOLVED]Where to add the lX11 reference to Qt project on linux

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.5k 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.
  • A Offline
    A Offline
    antonyprojr
    wrote on last edited by
    #1

    I'm writing a program to simulate keyboard events, but when i try to compile i get six "undefined reference to", after reading some articles i discovered that is a missing of a reference to lX11, but i don't understand exactly where to add this reference.

    @#include <QtCore/QCoreApplication>
    #include <X11/Xlib.h>
    #include <X11/keysym.h>
    #include <X11/extensions/XTest.h>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    Display *display = XOpenDisplay(NULL);
    unsigned int keycode;
    keycode = XKeysymToKeycode(display, XK_Pause);
    XTestFakeKeyEvent(display, keycode, True, 0);
    XTestFakeKeyEvent(display, keycode, False, 0);
    XFlush(display);
    
    return a.exec(&#41;;
    

    }@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      antonyprojr
      wrote on last edited by
      #2

      I found, add to .pro file: @LIBS += -lXtst -lX11@

      1 Reply Last reply
      0

      • Login

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