I've been trying to debug and compile my C++ with Xlib code in CodeLite for a while now, but I can't seem to pass the -lX11 argument to the gcc compiler in CodeLite. How would I go about doing this (On Linux Ubuntu 16.04 LTS)?
Code:
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <X11/Xlib.h>
int main(int argc, char **argv){
Display *display;
XEvent event;
Window win;
int screen;
bool running = true;
display = XOpenDisplay(NULL);
screen = DefaultScreen(display);
win = XCreateSimpleWindow(display,XRootWindow(display,screen),100,100,500,300,1,XBlackPixel(display,screen),XWhitePixel(display,screen));
XMapWindow(display,win);
while(running){
XNextEvent(display,&event);
}
}
Console Output:
----------Building project:[ Xlib - Debug ]----------
make[1]: Entering directory '/home/owner/Documents/C/Xlib'
/usr/bin/g++ -o ./Debug/Xlib @"Xlib.txt" -L.
./Debug/main.cpp.o: In function `main':
/home/owner/Documents/C/Xlib/main.cpp:14: undefined reference to `XOpenDisplay'
/home/owner/Documents/C/Xlib/main.cpp:16: undefined reference to `XWhitePixel'
/home/owner/Documents/C/Xlib/main.cpp:16: undefined reference to `XBlackPixel'
/home/owner/Documents/C/Xlib/main.cpp:16: undefined reference to `XRootWindow'
/home/owner/Documents/C/Xlib/main.cpp:16: undefined reference to `XCreateSimpleWindow'
/home/owner/Documents/C/Xlib/main.cpp:17: undefined reference to `XMapWindow'
/home/owner/Documents/C/Xlib/main.cpp:20: undefined reference to `XNextEvent'
Thanks in advance.