Undefined link to XOpenDisplay in a Qt project

Now I feel pretty stupid. I am trying to do some things with xlib in Qt Creator.

My code is:

#include <QtCore/QCoreApplication> #include <X11/Xlib.h> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); Display *display = XOpenDisplay(NULL); return 0; } 

Only one line of code and gives me:

 /main.cpp:8: undefined reference to `XOpenDisplay' 

It is defined in Xlib.h as

 extern Display *XOpenDisplay( _Xconst char* /* display_name */ ); 

I feel that I am missing something very basic.

+4
source share
1 answer

Found ... compiler problem

-lX11 added to make file

+9
source

Source: https://habr.com/ru/post/1311873/


All Articles