Tirando screenshot com libx11

Atualmente estou tentando tirar uma captura de tela usando libx11

<code>#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>

int main(void) {
XImage* pic;
Display* dpl;
unsigned int buffer_size;

dpl = XOpenDisplay("127.0.0.1:0.0");

pic = XGetImage(dpl, RootWindow(dpl, DefaultScreen(dpl)), 10, 10, 201, 201,
        AllPlanes, ZPixmap);
}
</code>

se eu compilar o código usando -lX11 e executá-lo, continuo recebendo uma falha de segmentação. Alguma ideia?

Desde já, obrigado!

questionAnswers(2)

yourAnswerToTheQuestion