I am using GCC, what switches do I need to add to link with Xlib? After searching, all I could find was -lX11
, but that gave me ld: library not found for -lX11
I am using a mac (10.6), but I would not like anything that is Mac specific.
I am using GCC, what switches do I need to add to link with Xlib? After searching, all I could find was -lX11
, but that gave me ld: library not found for -lX11
I am using a mac (10.6), but I would not like anything that is Mac specific.
You can usually use
pkg-config
to determine the flags you need to pass:I'd try
to set the search path for libraries.
You also need
-L/usr/X11/lib
. It's not exactly Mac-specific, but you will find that the location of these libs will vary a bit from system to system.You'd be surprised, but sometimes
-L/usr/X11R6/lib -lX11
is the answer -_-.Ubuntu 12.10 (And probably others) require
sudo apt-get install libx11-dev
.