I have heard that a way to write Cross Platform c++ code is to define classes as follows (for example, a Window class):
window.h
window_win32.cpp
window_linux.cp
The point of such an approach is, that you encapsulate OS specific data in the os specific file. If your have to pass around a HWND, then you might reconsider your object design. Wether such a strcuture makes sense depends on how big your os specific code is. You don't really want to squeeze all possible classes into a single file.
On the other hand, there are libraries for GUIs which are doing exactly this - encapsulating the OS specific parts in a library like QT or wxWidgets or others. If you properly separate the GUI from the main code, then you may not even need this approach.
I'm using such a structure in my project to support different versions of xerces, without having the maincode cluttering with #ifdefs
. However in my case, the affected code is rather small. I can imagine that a GUI framework takes much more space.