xcodemacosx11osx-lion

Mac OSX Lion/X11/CImg Library


So I'm trying to incorporate the CImg image writing library into my XCode project However, the header file for the library contains the following include and XCode gives this error warning:

#include <X11/Xlib.h>  Error: File not found

My laptop is running OSX Lion 10.8.2 and apparently, apple took away X11 for Lion, so I went on this site and downloaded XQuartz because that's what it said to do on the Apple Support page.

So after the installation, I restarted my computer and tried to run my XCode project, but I'm still getting the same exact error on that include.

So I'm not sure what I should do now to fix this. If I search in finder for "XLib.h", it appears and I have a folder called X11 which appears in my finder as well, so I feel like I probably have what I need but I can't figure it out.


Solution

  • The header file Xlib.h is in /opt/X11/include, so add that path to the Header Search Paths in Xcode:

    enter image description here

    You'll probably need to add libraries from /opt/X11/lib as well...