Using X11 on OSX 10.8.3: "ld: library not found for -lX11"

I have the following make file:

PROG    = draw
CFLAGS  = -w -s -O2 -ansi -DSHM
XLIBS   = -lX11 -lXext -lXmu -lXext -lXmu -lXt -lXi -lSM -lICE
LIBS    = -framework OpenGL
INCLS   = -I/usr/X11R/include -I/share/mesa/include
LIBDIR  = -L/usr/X11/lib -L/usr/X11R6/lib
#source codes
SRCS = draw_main.cpp $(PROG).cpp
#substitute .cpp by .o to obtain object filenames
OBJS = $(SRCS:.cpp=.o)

#$< evaluates to the target dependencies,
#$@ evaluates to the target

$(PROG): $(OBJS)
    g++ -o $@ $(OBJS)  $(LIBDIR) $(LIBS) $(XLIBS)

$(OBJS):
    g++ -c  $*.cpp $(INCLS)

clean:
    rm $(OBJS) 

Every time I try to run it, I get the following error:

ld: library not found for -lX11
collect2: ld returned 1 exit status

Can someone please help me find out where the X11 library should be in OSX 10.8.3? It looks right to me.

Thanks in advance.

+5
source share
1 answer

Have you installed XQuartz as suggested here: http://support.apple.com/kb/HT5293 ?

By default, Mountain Lion does not have X11.

+4
source

All Articles