ld can't find X11 library on OSX Leopard

怎甘沉沦 提交于 2019-12-01 06:33:39

You may be looking in the wrong location for the library; it's certainly in a different location on my OS X box. Try typing:

locate libX11.dylib

and adding an appropriate path. E.g. on my system you'd need -L/usr/X11/lib/ in you CFLAGS.

Juan Carlos Kuri Pinto
gcc SimpleXlibApp.c -o SimpleXlibApp -lX11 -L/usr/X11/lib -I/usr/X11/include

That line compiles the example here: http://en.wikipedia.org/wiki/Xlib

-L/usr/X11/lib doesn't work with OSX 10.6 and it has libX11.dylib :

% ls -l /usr/X11/lib/libX11.*
lrwxr-xr-x  1 root  wheel       14 Jul 21 17:46 /usr/X11/lib/libX11.6.2.0.dylib@ -> libX11.6.dylib
-rwxr-xr-x  1 root  wheel  3578368 Jul 12  2010 /usr/X11/lib/libX11.6.dylib*
lrwxr-xr-x  1 root  wheel       14 Jul 21 17:46 /usr/X11/lib/libX11.dylib@ -> libX11.6.dylib
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!