Using X11 in OSX 10.8.3 : “ld: library not found for -lX11”

走远了吗. 提交于 2019-11-30 17:11:46

问题


I have the following makefile:

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's 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 library for X11 is supposed to be in OSX 10.8.3? To me, this looks correct.

Thanks in advance.


回答1:


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

By default there is no X11 on Mountain Lion.



来源:https://stackoverflow.com/questions/15779181/using-x11-in-osx-10-8-3-ld-library-not-found-for-lx11

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!