But makefiles don't include headers
If XLib.h gets included, it's because somehere in your headers (or most likely in one of the external headers that you include) there is a #include <XLib.h>.
Sometimes its burried deeply inside headers, so it may be hard to figure out which header leads to #include <XLib.h>. A simple solution is to always include SFML (and headers that include SFML) first.
You don't get any error on Windows because XLib is a Linux library.