0

I'm trying to compile a test file which uses the Cmage library (http://cimg.sourceforge.net).

I already generated the .o file but apparently this file uses the X11 Library and I'm having some problems when linking.

If I do this:

g++ -o test CImg_demo.o

I get this:

Undefined symbols for architecture x86_64: "_XAllocClassHint", referenced from: cimg_library::CImgDisplay::_assign(unsigned int, unsigned int, char const*, unsigned int, bool, bool)in CImg_demo.o "_XCheckMaskEvent", referenced from: cimg_library::CImgDisplay::_events_thread(void*) in CImg_demo.o etc, etc

If I do this:

g++ -o test CImg_demo.o -lX11

I get this:

ld: library not found for -lX11 collect2: ld returned 1 exit status

As my OS X is mavericks, X11 has been installed with XQuartz in /opt/X11/lib/ So I tried to add that directory where all the .dylib files are at the beginning of the line, like this:

g++ -L/opt/X11/lib/ -o test CImg_demo.o

but I get exactly the same references problem.

Does anyone know how to find out the directory that includes all the object files to correctly make the linking?

Thank you in advance.

Bravado
  • 137
  • 9

0 Answers0