Problem including X11 in XCode.

Joined
Mar 18, 2013
Messages
3
Reaction score
0
Points
1
I am using XCode and a library called CImg which uses X11. When I run this program:
include "CImg.h"
using namespace cimg_library;
int main() {
CImg image("snail.bmp");
}

I get these errors:

Undefined symbols: "_XUnlockDisplay", referenced from:
"_XGetVisualInfo", referenced from: cimg_library::CImgDisplay::_assign(unsigned int, unsigned int, char const*, unsigned int, bool, bool)in main.o
"_XStoreColors", referenced from: cimg_library::CImgDisplay::_set_colormap(unsigned long&, unsigned int)in main.o
etc.

I think XCode doesn't know where my X11 is, and to be honest I'm not sure I've installed it correctly. I think it is supposed to be in opt/X11 but I don't see it.
Any idea of how to fix this?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
I'm not sure what version of OS X you're using but if you're using Snow Leopard or newer, head over to the XQuartz project and install X11 from there.
 
OP
C
Joined
Mar 18, 2013
Messages
3
Reaction score
0
Points
1
I'm not sure what version of OS X you're using but if you're using Snow Leopard or newer, head over to the XQuartz project and install X11 from there.

I am using 10.5.8 and have installed XQuartz. I am still getting the same error though. I think it has to do with changing my command line tools in XCode. How do I do this?
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
What you need to do is install the X11 SDK, or Software Development Kit. Don't ask me where to get it, haven't messed with that in a LONG time.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top