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.


Comments

Popular posts from this blog

Using PlayStation 1 Densha de Go controller on emulators

Using PS1/PC Densha de Go! controller SLPH-00051/TCPP-20001/DGOC-44U on PS4/Switch Densha de Go!!

Play octoshape stream on windows with VLC player