本文介绍了在OSX 10.8.3中使用X11:"ld:找不到-lX11库"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下makefile:

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

有人可以帮我找出X11库应该在OSX 10.8.3中的哪个位置吗?在我看来,这是正确的.

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.

谢谢.

推荐答案

是否已按照以下建议安装XQuartz: http://support.apple.com/kb/HT5293 吗?

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

默认情况下,Mountain Lion上没有X11.

By default there is no X11 on Mountain Lion.

这篇关于在OSX 10.8.3中使用X11:"ld:找不到-lX11库"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 22:59