It looks like you're using Display and Visual inside img.h, which is included in options.cpp. The correct thing to do here is to make img.h include the X11 headers it needs. You may also want to not include img.h in options.cpp, if possible.

Another thing you might be able to do in many similar cases, is instead of #including the hearer that defines the classes that are used as pointers and references in your headers, you can put in a forward declaration of those classes. For example at the top of img.h you could put "class Display;" and "class Visual;". This is simpler and compiles quicker.

Finally, in order to avoid this kind of problem, you can change the order of #include directives in your cpp files to put system libraries last. This way, if a header needs a system that it does not include, you will get an error immediately, instead of much later when you try to include that header in a new file.