Found this link to a c script that claims to take a screenshot of the running machine, so I copied it and installed all that libraries needed for compiling this file
Hereyou can find info on how to to install the cairo lib
I am using gcc to compile the script and I tried compiling using the following commands
gcc -I/usr/include/cairo -lcairo -lX11 pic.c
gcc -I/usr/include/cairo -lX11 pic.c
gcc -Wall -I/usr/include/cairo -lm -lX11 pic.c
This is what i get when compiling
/usr/bin/ld: /tmp/ccOh9u2g.o: in function `main':
pic.c:(.text+0x91): undefined reference to `XOpenDisplay'
/usr/bin/ld: pic.c:(.text+0x15e): undefined reference to `cairo_xlib_surface_create'
/usr/bin/ld: pic.c:(.text+0x175): undefined reference to `cairo_surface_write_to_png'
/usr/bin/ld: pic.c:(.text+0x181): undefined reference to `cairo_surface_destroy'
collect2: error: ld returned 1 exit status
this is what i am using
Target: x86_64-linux-gnu
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)