The usual solution is to define just the one class in the
header, and provide different source files for it, compiling
and linking whichever is necessary. If you need some
dependencies (e.g. data types) in class definition, you can also
achieve this, by creating a specific header file for each
platform, and including it. The simplest solution here is
probably to create a directory per target platform, and put all
of the platform dependent files there, using -I
//I
to pick
up the correct directory (and thus the correct platform
dependent files) at compile time.
Excessive use of #ifdef
is usually a sign of poor design. See
https://www.usenix.org/legacy/publications/library/proceedings/sa92/spencer.pdf.