0

I am trying to compile someone else's example code that uses X11 with gcc as follows

gcc -lX11 win.c -o win

/usr/bin/ld: /tmp/ccvn6Q0E.o: in function `main':
win.c:(.text+0x12): undefined reference to `XOpenDisplay'
/usr/bin/ld: win.c:(.text+0x71): undefined reference to `XCreateWindow'
/usr/bin/ld: win.c:(.text+0x8c): undefined reference to `XMapWindow'
/usr/bin/ld: win.c:(.text+0x98): undefined reference to `XFlush'

I have already got X11 on my computer (I'm using Ubuntu 20.04.3)

I looked at a similar post suggest also getting xserver-xorg-dev and xorg-dev, but that didn't do anything.

I have also tried using the gcc flags: -L /usr/lib/X11 -L /usr/lib/x86_64-linux-gnu/X11

Is there perhaps something that I am missing in my library?

Thanks heaps!

0 Answers0