CImg with Linux
To build applications using CImg library in Linux, you need to link the pthread and X11 library. Otherwise you'll get a bunch of link errors as follows: ./main.o: In function `cimg_library::CImgDisplay::screen_width()': /usr/include/CImg.h:6659: undefined reference to `XOpenDisplay' /usr/include/CImg.h:6663: undefined reference to `XCloseDisplay' ./main.o: In function `cimg_library::CImgDisplay::screen_height()': /usr/include/CImg.h:6678: undefined reference to `XOpenDisplay' /usr/include/CImg.h:6682: undefined reference to `XCloseDisplay' ./main.o: In function `cimg_library::CImgDisplay::_handle_events(_XEvent const*)': /usr/include/CImg.h:6717: undefined reference to `XUnmapWindow' ... To do this in Eclipse IDE (which automatically generates the makefile for your programming project), from the main menu, go to Project -> Properties . Then follow the screenshot below for the setting.