“X11/Xlib.h”: no such file or directory on mac os x mountain lion

时光总嘲笑我的痴心妄想 提交于 2019-11-29 01:33:33

you need to compile with:

g++ -o ex ex.cpp -I/usr/X11R6/include -L/usr/X11R6/lib -lX11

the X11 headers are installed with xQuartz, but you need to reference them explicitly

If you install xQuartz it installs into /opt/X11, and /usr/X11 and /usr/X11R6 are symlinks to this location

You may need to add symbolic link to X11 folder by:

sudo ln -s /opt/X11/include/X11 /usr/local/include/X11

In my case, I had to make include directory under usr/local.

This solution worked for me for ruby-1.9.3-p362 on Mavericks.

sudo ln -s /opt/X11/include/X11 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!